android - 如何通过 Android Intent 使用外部应用程序打开 3D-PDF 文件
问题描述
我在我的 Android 应用程序中下载了一个 3D-PDF 文件,我想通过 Intent 在外部应用程序中打开它。我使用“3D PDF Reader”作为外部应用程序。
这是Java中的源代码:
Uri fileUri = FileProvider.getUriForFile(MainActivity.this,
BuildConfig.APPLICATION_ID + ".provider", file);
try {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(fileUri, "application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(intent);
} catch (ActivityNotFoundException e) {
showMessage("Keine App zur Anzeige von PDF-Dokumenten gefunden!");
}
错误消息是:“抱歉,无法从此 PDF 加载 3D 内容。该文档受保护或不包含 3D 内容。”
我可以使用此代码在外部应用程序中显示普通 PDF 文件。当我使用应用程序“Total Commander”(文件管理器应用程序)单击由我的应用程序下载的 3D-PDF 时,我可以在外部应用程序(“3D PDF 阅读器”)中加载 3D-PDF 文件)。所以一定有可能实现我的目标。
很感谢任何形式的帮助。
解决方案
推荐阅读
- c# - Add the function of finding the minimum element to the "Queue" structure
- node.js - sqlite-3 DB 的结果不会推送到 Javascript 数组
- google-cloud-storage - Meaning of "Minimum storage duration" of Google Cloud storage
- amazon-cloudformation - 如何将 Route53 A 记录定位到 ApiGateway v2
- ruby-on-rails - 在 Rails 5.2 上使用 roo 读取电子表格时如何避免导入 nil 对象?
- scala - How does implicit conversions between scala-java collections work? How is it possible that it is sufficient to import some package?
- java - Spring Retry with for loop
- vba - How to get the return value of a function in Access vba?
- vba - Changing colour of text segments in a powerpoint presentation
- php - Using Array in Product Attribute comparison