Reputation: 1134
We have an android app which is on google play and on android. We wish to check in runtime if the game has been downloaded from google play or for amazon (for purposes of in-app purchases sdk and also analytics). How can we check it?
Upvotes: 1
Views: 125
Reputation: 199805
You can use PackageManager.getInstallerPackageName() to query from which store the app has been downloaded from.
For Google Play, it returns com.android.vending
. For Amazon it returns com.amazon.venezia
. Note, if you install it manually (i.e., via adb), it will by default return null. You can use
adb shell pm install -i com.myappstore com.example.package
To fake any installer you want for testing purposes.
Upvotes: 2