-1

I would like to assess in my app where it was installed from.

It seems that the PackageManager class is helpful and it is said in some SO answers that the method getInstallerPackageName() yields the "com.android.vending" string for Google Play.

I am asking here if this string is going to be reliable on also in the future, or instead if it is likely or possible to change.

My app would use a string comparison, so if it is not updated (for example, if I do not want, I am not interested or I am not able to update it) the check will fail.

P5music
  • 3,197
  • 2
  • 32
  • 81
  • Just use the method. If it does change, then how would that affect your code in any way? – OneCricketeer Aug 01 '16 at 13:08
  • @cricket_007 My app would use a string comparison, so if it is not updated (for example, if I do not want, I am not interested or I am not able to update it) the check fails. – P5music Aug 01 '16 at 13:26
  • So, you are going to have hard-coded well known package names that you can string compare against? I'm assuming the alternative would be to read the Manifest of those packages and inspect the actual app name – OneCricketeer Aug 01 '16 at 13:41
  • @cricket_007 I am not interested in real app names but just the getInstallerPackageName() return value – P5music Aug 01 '16 at 13:45
  • Okay, I assumed you needed to know the package name to map "com.android.vending" to "Google Play". That seems to be what you meant by *I would like to assess in my app where it was installed from* – OneCricketeer Aug 01 '16 at 13:48
  • @cricket_007 How can you read manifest of installer details ? Can you please explain ? I need Google Play for Play Store and Baidu for Baidu Store – Anand Apr 10 '18 at 19:54

1 Answers1

0

There is no guarantee that it will not change but change is very less likely as it is the main package name.