可靠地检测对Android设备的PDF支持 [英] Reliably detect PDF support on Android device
问题描述
我使用的方法来检测是这样的在Android设备上的PDF支持
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;
}
}
和已经被伟大的工作至今。我知道至少有HTC的默认浏览器,droidreader和Adobe Acrobat得到报告说方式和正确的返回结果。不过,我现在得到关于用户,说他有设备上的PDF支持市场控制台注释,但是从应用程序中所描述的行为,我的结论是此方法返回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.
有没有更好的方法来检测PDF支持?
Is there any better way to detect pdf support?
PS:我很想能够要求用户在市场上的细节
PS: I would love to be able to ask the user for details on the market.
推荐答案
从各种来源,我发现和实践经验的测试在一个相当大的各种设备我采取的方法是正确的。
From all sources I found and practical experience testing on a rather large variety of devices the approach I have taken is correct.
我还没有得到任何进一步的反馈意见,并认为有可能是用户错误或涉及一个坏的PDF应用程序版本。
I have not had any further feedback and think there might have been user error or a bad pdf application version involved.
这篇关于可靠地检测对Android设备的PDF支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!