意图过滤器浏览XML(尤其是RSS)的机器人尤其是、过滤器、意图、机器人

2023-09-05 04:40:05 作者:夜袭尼姑庵

我有我想要运行的每个用户进入到一个XML时间的活动(特别是RSS)页面在浏览器(至少假设用户得到的是从应用程序列表,可以支持它)。

I have an activity that I want to run every time the user goes to an xml (specifically rss) page in the browser (at least assuming the user get's it from the list of apps that can support it).

我公司目前已经拥有了目前的意图过滤器:

I currently already have the current intent filter:

    <activity android:name=".activities.EpisodesListActivity"
        android:theme="@android:style/Theme.NoTitleBar">
        <intent-filter>
            <category android:name="android.intent.category.BROWSABLE"></category>
            <category android:name="android.intent.category.DEFAULT"></category>
            <action android:name="android.intent.action.VIEW"></action>
            <data android:scheme="http"></data>
        </intent-filter>
    </activity>

现在,你可以猜到,这是一个邪恶的意图,因为它要开当一个页面是通过HTTP请求。然而,当我的广告行:

Now as you can guess, this is an evil intent, as it wants to open whenever a page is requested via http. However, when I ad the line:

<data android:mimeType="application/rss+xml"></data>

,使之:

    <activity android:name=".activities.EpisodesListActivity"
        android:theme="@android:style/Theme.NoTitleBar">
        <intent-filter>
            <category android:name="android.intent.category.BROWSABLE"></category>
            <category android:name="android.intent.category.DEFAULT"></category>
            <action android:name="android.intent.action.VIEW"></action>
            <data android:scheme="http"></data>
            <data android:mimeType="application/rss+xml"></data>
        </intent-filter>
    </activity>

应用程序不再声称能够运行的RSS文件。

The application no longer claims to be able to run rss files.

另外,如果我行更改为:

Also, if I change the line to:

<data android:mimeType="application/xml"></data>

这也将无法正常工作(适用于一般XML文件偶)。

It also won't work (for generic xml file even).

所以,我需要什么意图过滤器,使为了要求该活动支持RSS。

So what intent filter do I need to make in order to claim that the activity supports rss.

(另外,加分,如果你能告诉我怎么知道是什么网址是用户开放。到目前为止,我一直发送的信息,从一个活动到另一个使用群众演员)。

(Also, bonus points if you can tell me how I know what URL it was the user opened. So far, I've always sent that information from one activity to the other using extras).

感谢您的帮助

推荐答案

在以下线程解决方法:

How当RSS链接在浏览器中打开,打开我的Andr​​oid应用程序?