在 Galaxy S5 上使用 intent-filter 打开 .zip 文件

Opening .zip files with intent-filter on Galaxy S5

我试图在我正在编写的应用程序中打开一个 zip 文件,但是当我在 Galaxy S5 上的“我的文件”中浏览文件时,“我的文件”解压缩文件而不是打开应用程序。

如果我将扩展名更改为 .upgradezip,应用程序在打开传递给它的指定文件时没有问题,但我的文件似乎完全忽略了 intent 过滤器并尝试解压缩文件,具体来说,当扩展名是.zip

其他设备(包括 LG 平板电脑)可以使用我的应用程序打开 .zip 文件,使用与 Galaxy S5 相同的清单。

想法?这是我的清单中的相关信息,我在此期间同时支持 zip 和 upgradezip,但如果所有设备都使用 zip 会很好。

        <intent-filter>
            <action android:name="android.intent.action.VIEW"/>
            <category android:name="android.intent.category.BROWSABLE"/>
            <category android:name="android.intent.category.DEFAULT"/>
            <data android:host="" android:scheme="content" android:pathPattern=".*\.upgradezip" android:mimeType="application/octet-stream"/>
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW"/>
            <category android:name="android.intent.category.DEFAULT"/>
            <data android:host="" android:scheme="file" android:mimeType="*/*" android:pathPattern=".*\.upgradezip"/>
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <action android:name="android.intent.action.EDIT" />
            <action android:name="android.intent.action.PICK" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="application/octet-stream" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <action android:name="android.intent.action.EDIT" />
            <action android:name="android.intent.action.PICK" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="application/zip" />
        </intent-filter>

编写自己的文件浏览器。当您调用外部程序来做某事时,尤其是可以根据设备更改的外部程序,您对其工作方式的控制绝对为零。它认为当你点击一个 zip 时最好的办法就是打开它。你无法阻止它这样做。因此,如果您真的不希望它这样做,请不要使用该应用程序。强制它不这样做的唯一方法是自己编写。