我有两种自定义文件类型,我的应用程序可以处理这些文件类型,我希望能够从各种其他应用程序中打开它们。我为许多人(包括Gmail和“设置”文件浏览器)工作的东西,但是还有一些第三种文件管理器(包括Samsung My Files和Astro File Manager)无法识别这些文件类型属于我的应用程序。有没有一种方法可以使这些文件浏览器应用程序识别出应该由我的应用程序打开这些文件的意图过滤器?
这是现有的意图过滤器:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- See http://stackoverflow.com/questions/1733195/android-intent-filter-for-a-particular-file-extension/2062112#2062112 -->
<!--
Capture content by MIME type, which is how Gmail broadcasts
attachment open requests. pathPattern and file extensions
are ignored, so the MIME type *MUST* be explicit, otherwise
we will match absolutely every file opened.
-->
<intent-filter
android:icon="@drawable/book"
android:label="@string/app_name"
android:priority="50">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<!-- needed for properly formatted email messages -->
<data
android:mimeType="application/vnd.bloom"
android:scheme="content" />
<!-- …Run Code Online (Sandbox Code Playgroud) android ×1