Reputation: 29912
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.
Upvotes: 13
Views: 3794
Reputation: 5173
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.
Upvotes: 2
Reputation: 29912
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.
Upvotes: 3