Cod*_*ile 11 rss android intentfilter android-intent
我正在为我的Android手机创建一个rss聚合器.我希望能够从浏览器订阅RSS订阅源,因为大多数网站都通过rss按钮订阅.
如何构建一个意图过滤器来接收这些链接?
这个问题类似,并展示了如何创建一个处理浏览器链接的意图过滤器: 在Android浏览器中创建一个链接启动我的应用程序?
但是,我不知道如何使它特定于rss feed.作为尝试,我尝试了这个过滤器:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<data android:mimeType="application/rss+xml" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
Run Code Online (Sandbox Code Playgroud)
我是在正确的轨道上吗?我应该过滤什么?
why*_*not 21
这3个过滤器似乎是GoogleListen和GoogleReader应用使用的过滤器:
<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"/>
<data android:host="*"/>
<data android:pathPattern=".*\\.xml"/>
<data android:pathPattern=".*\\.rss"/>
</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"/>
<data android:host="feeds.feedburner.com"/>
<data android:host="feedproxy.google.com"/>
<data android:host="feeds2.feedburner.com"/>
<data android:host="feedsproxy.google.com"/>
</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"/>
<data android:mimeType="text/xml"/>
<data android:mimeType="application/rss+xml"/>
<data android:mimeType="application/atom+xml"/>
<data android:mimeType="application/xml"/>
</intent-filter>
Run Code Online (Sandbox Code Playgroud)
事实证明,播客可以设置很多不同的方式,因此每个意图过滤器只适用于其中一些.需要使用许多不同的过滤器来获得大多数订阅链接所需的效果.
以下是我发现的一些过滤器:
<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="itpc" />
<data android:scheme="pcast" />
<data android:scheme="feed" />
<data android:scheme="rss" />
</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:host="*"
android:pathPattern=".*xml" />
<data android:scheme="http" android:host="*"
android:pathPattern=".*rss" />
<data android:scheme="http" android:host="*"
android:pathPattern=".*feed.*" />
<data android:scheme="http" android:host="*"
android:pathPattern=".*podcast.*" />
<data android:scheme="http" android:host="*"
android:pathPattern=".*Podcast.*" />
<data android:scheme="http" android:host="*"
android:pathPattern=".*rss.*" />
<data android:scheme="http" android:host="*"
android:pathPattern=".*RSS.*" />
</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:mimeType="text/xml" android:scheme="http" />
<data android:mimeType="application/rss+xml" android:scheme="http" />
<data android:mimeType="application/atom+xml" android:scheme="http" />
</intent-filter>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6104 次 |
| 最近记录: |