1

My app. is deployed in Play Store as well as Baidu Store. For notificatiions, need to differentiate from where app. is installed.

When I used getInstallerPackageName() method, Redmi Note 3 returns correct value but HTC returns null.

Why is this difference observed ?

Is there any other better way ?

Anand
  • 191
  • 1
  • 12

1 Answers1

0

Regarding this answer: https://stackoverflow.com/a/13293534/2724879 i suggest that when its null then its from Baidu and when its com.android.vending then its from google xD

Yamen Nassif
  • 2,416
  • 2
  • 24
  • 48
  • I do agree but if I want to deploy in multiple China Stores .. that will be difficult .. right ? .. any other better way ? – Anand Apr 16 '18 at 12:36
  • I do believe so since not all stores are adding the package naming :/ – Yamen Nassif Apr 16 '18 at 12:36
  • in that case, and i am not sure if it fits you. but you can generate different APKs for different stores with some parameter on your API to call your backend something like: myappbackend.com/api?store=china1, myappbackend.com/api?store=china2 – Yamen Nassif Apr 16 '18 at 12:38
  • and then you will read that parameter on the back end to know with which store you are dealing with – Yamen Nassif Apr 16 '18 at 12:39