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?
callback google play on installed app
1k views Asked by ThomasDhaen At
3
There are 3 answers
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.
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?