2013-03-06 64 views
1

我想在点击URL(可能是电子邮件或短信)上启动Android应用程序。意图过滤器的路径模式

如何为这两个URL编写不同的路径模式?

  • http://www.hostname.com/folder1/file.ext
  • http://www.hostname.com/folder1/folder2/file.ext

我只想从第一URL,而不是第二个启动我的活动。目前,我正在使用这个intent-filter,但它使用这两个URL启动我的应用程序。

<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="www.hostname.com" 
     android:pathPattern=".*\\/folder1/*" 
     android:scheme="http" /> 
</intent-filter> 

回答

0

下面的代码尝试

<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="www.hostname.com" 
     android:pathPrefix="/folder1" 
     android:scheme="http" /> 
</intent-filter>