Intent filter for browsing XML (specifically rss) in android
- by Leif Andersen
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>
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>
to make it:
<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>
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>
It also won't work (for generic xml file even).
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).
Thank you for your help