callback google play on installed app

1.1k Views Asked by At

We are creating an app where you can share an app, which sends the user to the google play store to download another app. My question is, how can I know if some user actually downloaded and installed that app? Is there a some sort of callback you get from the play store?

3

There are 3 best solutions below

0
On

Try calling startActivityForResult() with the Play Store intent. Then, override the onActivityResult() method in your Activity and check if the app is installed. This might help: How to check programmatically if an application is installed or not in Android?

1
On
isAppInstalledBefore("com.example.anappblabla");

private boolean isAppInstalledBefore(String packageName) {
    PackageManager pm = getPackageManager();
    boolean installed = false;
    try {
       pm.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES);
       installed = true;
    } catch (PackageManager.NameNotFoundException e) {
       installed = false;
    }
    return installed; //returns boolean
}
0
On

No, but:

What I would do is trying to get the package name (generally in the URL for example: https://play.google.com/store/apps/details?id=dev.laurentmeyer.contactautocompleteview of the target app (which is unique): something like dev.laurentmeyer.whateverApp (it's the one I'm personally using). Then scan the installed apps with this Helper and you'll be sure if it has been installed or not.