如何使一个意图过滤器用于流的MP3文件?过滤器、意图、文件

2023-09-05 08:20:24 作者:拼搏。努力

在Android上,如果你键入一个网址在浏览器中的MP3文件(或点击一个链接到该文件),你得到了完整的行动使用弹出并列出了一些应用程序,可以播放的文件(音乐,StreamFurious ,流媒体播放器,Winamp的,XiiaLive精简版,仅举几例)。我怎样才能让我的应用程序,以显示在该列表?

On Android, if you type a URL to an MP3 file in the browser (or click on a link to the file) you get that "Complete action using" popup with some applications listed that can play the file (Music, StreamFurious, Streaming Media Player, Winamp, XiiaLive Lite, to name a few). How can I get my application to show up in that list?

我是pretty的肯定有一个意图过滤器我有添加到AndroidManifest.xml中,但我也没办法行动,类别,或数据有什么需要它。任何人都知道我有什么关系?此外,有一些方法可以让我跟踪意图调用该系统上?这可能更容易弄清楚如何做其他的事情是这样的未来。

I'm pretty sure there's an intent-filter I have to add to the AndroidManifest.xml but I have no idea what action, category, or data needs to be in it. Anyone know what I have to do? Also, is there some way I can trace intents that called on the system? That might make it easier to figure out how to do other things like this in the future.

根据我所看到的,在code.google.com / P /安德利斯/来源/浏览/中继/ AndroidManifest.xml中规格= svn86和放大器; R = 86#我试过这样:

Based on what I saw at code.google.com/p/andless/source/browse/trunk/AndroidManifest.xml?spec=svn86&r=86# I tried this:

<activity android:name=".Main"
          android:label="@string/app_name">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:mimeType="audio/mp3" android:scheme="file" />
    </intent-filter>
</activity>

但是这并没有做到这一点。然后我下载安德利斯从市场,实现了该应用程序不会在完成操作使用列表或者显示。

but that didn't do it. Then I downloaded andLess from the market and realized that app doesn't show in the "Complete action using" list either.

推荐答案

无需接收器。这个工程。当你点击链接它会尝试链接到视图的内容,这样的意图过滤器所需要的视图操作和浏览的类别。和正确的数据的设置如下:

No receiver needed. This works. When you click the link it tries to "view" the contents of the link so the intent-filter needs the view action and browsable category. And the correct data settings are listed below:

<activity android:name=".Main"
          android:label="@string/app_name">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </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="http" android:pathPattern=".*mp3" android:mimeType="audio/*" />
    </intent-filter>
</activity>
 
精彩推荐
图片推荐