android - Android Intent Filters - 专有文件类型的空白 mimeType
问题描述
我使用意图过滤器将我的应用程序与我的专有文件类型相关联,因此用户可以点击文件并在我的应用程序中打开它。直到最近我一直在使用基于文件名的一个:
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:mimeType="*/*" />
<data android:scheme="file" />
<data android:scheme="content" />
<data android:host="*" />
<data android:pathPattern=".*\\.rhr" />
(加上 pathPattern 的其他变体以允许文件夹)
似乎从 Android 7 开始,应用程序无法共享 File URLs Official docs。没问题,我们可以使用 Mime 类型:
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="file" />
<data android:scheme="content" />
<data android:mimeType="[???]" />
除了某些应用程序不发送 mime 类型。例如,三星我的文件应用程序发送一个空字符串作为 mime 类型。
我可以求助于使用“*/*”,但这肯定会惹恼人们。还有其他选择吗?
解决方案
推荐阅读
- swift - 能够在 Firebase 中对用户进行身份验证,但不能将用户数据存储在 Firebase 数据库中
- batch-file - 在 Windows 上安全地杀死 java 进程
- python - Pyparsing 无法解析多个规则
- php - 有没有比使用 App\Entity\ as E 更好的方法
- javascript - 如何在单击向上和向下箭头按钮时上下移动选定/多选数组元素?
- html - 如何在 rails strong params 中包含 HTML 输入?
- c# - 如何在 DataGridView 的单元格中搜索精确值?
- dynamic-programming - 硬币变化:重叠的子问题是什么?
- java - 为什么 HBase 使用 NavigableMap
存储细胞? | - javascript - 在沙盒 iframe 中使用常见的 JS 库