I'm opening a PDF file through an intent; in order to check beforehand if a capable application is installed, I use this code:
PackageManager packageManager = context.getPackageManager();
Intent testIntent = new Intent(Intent.ACTION_VIEW);
testIntent.setType("application/pdf");
List<ResolveInfo> list = packageManager.queryIntentActivities(testIntent, PackageManager.MATCH_DEFAULT_ONLY);
return list.size() > 0;
This works fine on my Galaxy Nexus, however, the list is empty when run on a Kindle Fire. But if I skip the check, the PDF is opened just fine! How so?
Is there any other way to check for PDF viewing capablities? (The PDF is included in the APK asset's folder, and I would like to only copy it into the data folder if I know it can be displayed...)
Or should I just stop bothering to check as most Android devices can view PDFs anyway?
I'm fairly sure you can't query for that intent without setting the actual data the Intent should be able to operate on.
This link also seems to deal with the same problem.