user387184
user387184

Reputation: 11053

How to find out from where an app was installed?

I like the app to find out from where it was installed, like from GooglePlay, Amazon or just by installing it locally.

So when the app starts it knows where it came from.

Is that possible somehow?

Upvotes: 1

Views: 521

Answers (1)

kgandroid
kgandroid

Reputation: 5595

Use the method String getInstallerPackageName (String packageName).

For more information see this

you can use this method as:

String market=context.getPackageManager().getInstallerPackageName(context.getPackageName());

As far as I remember Amazon returns "com.amazon.venezia" and Google Play Store returns "com.android.vending".

Upvotes: 2

Related Questions