How to know an application is installed from google play or side-load?

The question:

I need to detect my application is installed from google play or other market, how could I get this information?

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

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.

EDIT: Note @mttmllns’ answer below regarding the Amazon app store.

Method 2

And FYI apparently the latest version of the Amazon store finally sets PackageManager.getInstallerPackageName() to "" as well to contrast with Google Play’s "".

Method 3

I use this code to check, if a build was downloaded from a store or sideloaded:

public static boolean isStoreVersion(Context context) {
    boolean result = false;

    try {
        String installer = context.getPackageManager()
        result = !TextUtils.isEmpty(installer);
    } catch (Throwable e) {          

    return result;


  fun isStoreVersion(context: Context) =
    try {
    } catch (e: Throwable) {

Method 4

If you are looking at identifying & restricting the side-loaded app. Google has come up with the solution to identify the issue.

You can follow as below

Project’s build.gradle:

buildscript {
 dependencies {
  classpath ''

App module’s build.gradle:

implementation ''

Class that extends Application:

public void onCreate() {
if (MissingSplitsManagerFactory.create(this).disableAppIfMissingRequiredSplits()) {
    // Skip app initialization.


With this integration, google will automatically identifies if there are any missing split apks and shows a popup saying “Installation failed” and it also redirects to Play store download screen where user can properly install the app via the Google Play store.

Check this link for more info.

Hope this helps.

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment