Reputation: 835
I am planning to create a kinda reward app in android. I am going to list up the game apps on my app. When the user download/install one of apps on the list, the use will get some point for quid pro quo.
What is the best way to check the completion of download and installation? Since the user is redirected to PlayStore to download when he/she clicks on the apps, I think that every apps on the list of my app, should put some codes (INTENT) to pass API URL call with App ID and User Device Info etc.
Any advice will be really appreciated.
Upvotes: 1
Views: 352
Reputation: 6721
I think the best way to know if an application has been installed is via the PackageManager
This is something you could do in an AsyncTask
as this is a bit slow based on number of applications present in the device.
final PackageManager pm = getPackageManager();
List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);
for (ApplicationInfo packageInfo : packages) {
for (i = 0; i < packages.size(); i++) {
if (packageInfo.packageName.compareToIgnoreCase("com.yourpackage") == 0) {
//Implies package is installed.
}
}
Upvotes: 1