首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安卓意图过滤器pathPattern

安卓意图过滤器pathPattern
EN

Stack Overflow用户
提问于 2012-12-11 17:33:51
回答 1查看 9.1K关注 0票数 4

我想做一个intent-filter,它可以像这样检测urls:

代码语言:javascript
复制
http://192.168.0.xx/playlist/_definst_/iphone.smil/list.m3u8?token=XXXXXXX

到目前为止,我试过了,但是没有成功。

代码语言:javascript
复制
    <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:host="*"
            android:pathPattern=".*\\*.m3u8.*"
            android:scheme="http" />
    </intent-filter>

我遗漏了什么?

需要你的帮助。

这对我很有效。希望对其他人也有帮助。

代码语言:javascript
复制
 <data android:scheme="http" android:host="*"
            android:pathPattern=".*\\.m3u8" />
        <data android:scheme="http" android:host="*"
            android:pathPattern=".*\\..*\\.m3u8" />
        <data android:scheme="http" android:host="*"
            android:pathPattern=".*\\..*\\..*\\..m3u8" />
        <data android:scheme="http" android:host="*"
            android:pathPattern=".*\\..*\\..*\\..*\\.m3u8" />
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-12-11 17:56:14

试试这个,

代码语言:javascript
复制
<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:mimeType="*/*" />
    <data android:pathPattern="*.*\\.m3u8" />
</intent-filter>

或者,使用以下代码

代码语言:javascript
复制
<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=".*\\.m3u8" />
</intent-filter>

这是可行的:

代码语言:javascript
复制
     <data android:scheme="http" android:host="*"
            android:pathPattern=".*\\.m3u8" />
        <data android:scheme="http" android:host="*"
            android:pathPattern=".*\\..*\\.m3u8" />
        <data android:scheme="http" android:host="*"
            android:pathPattern=".*\\..*\\..*\\..m3u8" />
        <data android:scheme="http" android:host="*"
            android:pathPattern=".*\\..*\\..*\\..*\\.m3u8" />
票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13817296

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档