I am using a method to detect pdf support on an Android device that goes like this
public boolean canDisplayPdf() {
PackageManager packageManager = application.getPackageManager();
Intent testIntent = new Intent(Intent.ACTION_VIEW);
testIntent.setType("application/pdf");
if (packageManager.queryIntentActivities(testIntent, PackageManager.MATCH_DEFAULT_ONLY).size() > 0) {
return true;
} else {
return false;
}
}
And that has been working great so far. I know that at least the HTC default viewer, droidreader and adobe acrobat get reported that way and the right result is returned. However I now got a comment on the market console by a user that says that he has pdf support on the device, but from the described behaviour of the app I conclude that this method returns false.
Is there any better way to detect pdf support?
PS: I would love to be able to ask the user for details on the market.
Open and read PDFs on Android. Launch the app. On the bottom menu bar, select Files. Locate your PDF file on your Android and select it. Read your document.
Go to Settings. Go to Apps. Select the other PDF app, that always open up automatically. Scroll down to "Launch By Default" or "Open by default".
Android has a built in framework from Android 5.0 / Lollipop, it's called PDFRenderer.
From all sources I found and practical experience testing on a rather large variety of devices the approach I have taken is correct.
I have not had any further feedback and think there might have been user error or a bad pdf application version involved.
You're doing it correctly. You could consider updating the description of your app to say that you invoke a PDF app using the Android-approved method with the application/pdf MIME type. And also mention that if users have any trouble with the app, you'd appreciate an email to [email protected] (or whatever your app support email address is setup to be). Maybe then they'd send an email instead of just leaving an anonymous comment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With