2013-03-06 111 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>