androidgoogle-playsamsung-mobileamazon-appstore

How android app can detect what store installed it?


I have app in Google Play, Amazon, Samsung Apps and I plan to upload to other stores. I do not wish to compile separate build for every store. Is there way to detect what store installed app if same app submitted to different stores?


Solution

  • You'll have to expand this for each additional store, but this should get you started

    if (context.getPackageManager().getInstallerPackageName(context.getPackageName()).equals("com.android.vending")
    {
    //do google things
    }
    else if (context.getPackageManager().getInstallerPackageName(context.getPackageName()).equals("com.amazon.venezia")
    {
    //do amazon things
    }