androidgoogle-playandroid-package-managersamazon-appstore

Can PackageManager.getInstallerPackageName() tell me that my app was installed from Amazon app store?


I plan on publishing my app on Amazon app store as well as Google Play, and have some things in my app that need to behave slightly different depending on whether the app was installed from Amazon app store or not. If I understood the PackageManager.getInstallerPackageName(String packageName) method correctly, it tells me the name of the application that installed my app. Right? If so, does anyone know what the value returned by this method would be if my app was installed from Amazon app store? If not, does anyone know any other methods I can use to determine whether my app was installed from the Amazon app store?

Note: I am aware of other questions on Stack Overflow which have been answered alluding to the usage of PackageManager.getInstallerPackageName(String packageName) to determine the name of the application that installed my app. However, searching Stack Overflow and elsewhere, I have not been able to determine what the value returned by PackageManager.getInstallerPackageName(String packageName) would be in case the app was installed from the Amazon app store.


Solution

  • Calling PackageManager.getInstallerPackageName(myPackageName), where myPackageName is the name of the package (of the app for which you wish to determine the installer) gives the following values:

    (Thanks @CommonsWare for the pointer.)