6

Is it possible to get the source of install from an Android app?

I mean, I want to see, if the app is installed from the Play Store, Amazon Appstore or via executing an APK.

PS: I think to see it while my app crashes and I was able to send an bug report, that my app was installed via Play Store. How do I get this value?

mars3142
  • 2,371
  • 3
  • 27
  • 54

3 Answers3

13

The PackageManager class supplies the getInstallerPackageName method that will tell you the package name of whatever installed the package you specify. Side-loaded apps will not contain a value.

The latest version of the Amazon store finally sets PackageManager.getInstallerPackageName() to "com.amazon.venezia" as well to contrast with Google Play's "com.android.vending".

Source: How to know an application is installed from google play or side-load? For an Example: getInstallerPackageName returns null

Community
  • 1
  • 1
Mdlc
  • 6,836
  • 11
  • 53
  • 96
2

Use getInstallerPackageName.

This stores the packageName of what installed the application.

  • Google Play: "com.android.vending"
  • Amazon Appstore: "com.amazon.venezia"
shkschneider
  • 17,185
  • 13
  • 56
  • 110
2

At present (16/01/2022) code:

val s = applicationContext.getPackageManager().getInstallerPackageName(applicationContext.getPackageName())

works fine for Android 11 in GooglePlay, and get "com.android.vending".