[英]Android Intent Filter: Can't open audio file from preview?
I want my android app to be able to open MP3 files and a few other formats from a VIEW intent.我希望我的 android 应用程序能够从 VIEW 意图打开 MP3 文件和其他一些格式。 I almost have this working but there are some cases where it won't show up in the "Open with..." menu.我几乎可以完成这项工作,但在某些情况下,它不会出现在“打开方式...”菜单中。
For example, if I select an mp3 file in Files and choose "Open with" I see a list of apps that includes mine ("N-Space" in the screenshot).例如,如果我在“文件”中选择一个 mp3 文件并选择“打开方式”,我会看到一个包含我的应用程序列表(屏幕截图中的“N-Space”)。
But when I tap the mp3 file it opens a preview.但是当我点击 mp3 文件时,它会打开预览。 If I choose "Open with" from this preview screen, I get a different set of apps, which doesn't include mine.如果我从此预览屏幕中选择“打开方式”,则会得到一组不同的应用程序,其中不包括我的应用程序。
Why would a different set of apps appear for the same file?为什么同一文件会出现一组不同的应用程序? Is it using a different MIME type or a different action type?它使用的是不同的 MIME 类型还是不同的操作类型? How can I get my app to show up in that list?如何让我的应用程序显示在该列表中?
Here's the relevant part of my manifest:这是我的清单的相关部分:
<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:scheme="file" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:scheme="content" />
<data android:mimeType="audio/mpeg" />
<data android:mimeType="audio/mp3" />
<data android:mimeType="audio/mpeg3" />
<data android:mimeType="audio/x-mpeg-3" />
<!-- ... and more for other file types -->
</intent-filter>
I can't use audio/*
because my app only supports certain audio formats.我不能使用audio/*
因为我的应用程序只支持某些音频格式。
It turns out the second "Open with..." menu shows a maximum of 3 apps.事实证明,第二个“打开方式...”菜单最多显示 3 个应用程序。 I uninstalled some of them and my app appeared.我卸载了其中一些,然后我的应用程序出现了。 Might be a bug?可能是一个错误?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.