AJ222
AJ222

Reputation: 1134

How to recognize in runtime that we are running on an apk that was downloaded from Amazon

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

Answers (1)

ianhanniballake
ianhanniballake

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

Related Questions