At the app start, how to know a android app come from Google Play store,or other store,for example amazon store.
Asked
Active
Viewed 93 times
0
-
I suspect [this](http://stackoverflow.com/questions/5578871/how-to-get-app-signature) may help. – Joachim Isaksson Sep 01 '14 at 08:18
-
@JoachimIsaksson : Are you really sure about that link being of help? As far as I can tell it simply deals with the signature of the apk which has nothing to do with the installation source. I upload exactly the same signed release versions of my app to both Google Play and Amazon. – Squonk Sep 01 '14 at 08:27
-
@Squonk Hm, I was under the impression that the store wraps the signed APK in an outer signature indicating the store (hence the necessity to enable the unknown sources setting to use the Amazon store on a regular Android device). Been a while though, I may remember that incorrectly. – Joachim Isaksson Sep 01 '14 at 14:34
1 Answers
0
Whilst it's not foolproof, you should have a look at the value returned by:
PackageManager.getInstallerPackageName(nameOfPackage);
Sometimes this returns an empty/null string, but if not then a value of "com.android.vending" means it was installed from the Play store. Not all versions of the Amazon store set this value, but if you have a string that starts "com.amazon" then it was probably installed from the Amazon store!

Vadim Kotov
- 8,084
- 8
- 48
- 62

zmarties
- 4,809
- 22
- 39