I use this snippet to check if the application / action is installed:
public static boolean isIntentAvailable(Context context, String action) {
final PackageManager packageManager = context.getPackageManager();
final Intent intent = new Intent(action);
List<ResolveInfo> list =
packageManager.queryIntentActivities(intent,
PackageManager.MATCH_DEFAULT_ONLY);
return list.size() > 0;
}
public static boolean isScanAvailable(Context context) {
return isIntentAvailable(context, "com.google.zxing.client.android.SCAN");
}
In the above example, it checks to see if a barcode scanner application is installed, which works fine. However, if I try to check Adobe Flashplayer with com.adobe.flashplayer, it does not work and always returns false.
Is there a better / more reliable way to test Flash?
source
share