【发布时间】:2014-12-18 13:36:45
【问题描述】:
我有一个像 .foo 这样的自定义文件扩展名,我想将我的应用与之关联。我创建了这个 Intent-Filter:
<intent-filter>
<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" android:pathPattern=".*\\.foo"/-->
<data android:scheme="file" android:mimeType="*/*" android:pathPattern=".*\\.foo" android:host="*"/>
</intent-filter>
问题是这在某些设备上不起作用。例如,只有以下内容适用于三星 Galaxy S3(Android 版本:4.4.2):
<data android:scheme="file" android:mimeType="*/*" android:pathPattern=".*\\.foo" android:host="*"/>
但是,对于 LG G2(Android 版本:4.4.2),只有这行有效:
<data android:scheme="file" android:pathPattern=".*\\.foo"/>
更糟糕的是,Nexus 7(Android 版本:5.0)似乎根本无法识别自定义文件结尾。
有没有人遇到过类似的问题并知道解决方案?
【问题讨论】:
标签: android android-manifest intentfilter file-extension