2012-12-11 56 views
3

我要让意图过滤器,可以检测到这样的一个网址:
Android的意图过滤pathPattern

http://192.168.0.xx/playlist/_definst_/iphone.smil/list.m3u8?token=XXXXXXX 

这个我试过,到目前为止,但没有运气。

<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> 

我错过了什么?
需要你的帮助。
这对我有用。希望它也能帮助其他人。

<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" /> 

回答

5

这种尝试,

<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> 

或者,与此

<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> 

这工作:

 <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" /> 
+0

都尝试,但没有工作。不管怎么说,还是要谢谢你。 –

+0

如果我删除了iphone和smil之间的点(iphone.smil)它的工作原理。我认为这个点与它有关。 –

+1

看看这个:[http://stackoverflow.com/a/12153391/556975]。它显示了如何处理这种情况。 –