How android app can detect what store installed it?

后端 未结 3 505
温柔的废话
温柔的废话 2020-12-24 08:56

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 st

3条回答
  •  佛祖请我去吃肉
    2020-12-24 09:48

    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
    }
    

提交回复
热议问题