I want to check whether an app is installed on the device or not. I am using code below :
PackageManager pm = context.getPackageManager();
List
I found the answer here
Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
List pkgAppsList =
context.getPackageManager().queryIntentActivities( mainIntent, 0);
for (ResolveInfo resolveInfo : pkgAppsList) {
Log.d(TAG, "__<>"+resolveInfo.activityInfo.packageName);
if (resolveInfo.activityInfo.packageName != null
&& resolveInfo.activityInfo.packageName.equals(uri)) {
return true;
}
}
return false;
This worked for me perfectly.