2011-09-01 103 views
10

我想要在瀏覽器中訪問某個HTML URL時嘗試放置一個意圖過濾器來啓動我的應用程序。當它是標準網址時,我沒有問題,例如www.stonyx.com。使用Android Intent過濾器匹配URL中的HTTP參數

但是,我需要匹配一個URL與HTTP參數,如www.stonyx.com/?pagename,它是後面的部分?我遇到了匹配問題。

我採用了android嘗試:路徑,機器人:pathPrefix,和android:pathPattern,和他們都不做,我...不知道,如果是因爲我做錯了什麼,或者如果它只是因爲它是一個帶有問號的php路徑。任何幫助,高度讚賞。

P.S.這是我目前的意圖過濾器看起來像

<intent-filter> 
    <action android:name="android.intent.action.VIEW"></action> 
    <category android:name="android.intent.category.DEFAULT"></category> 
    <category android:name="android.intent.category.BROWSABLE"></category> 
    <data android:host="www.megaupload.com" android:scheme="http"></data> 
</intent-filter> 

回答

11

你不能。 :(根據http://developer.android.com/guide/components/intents-filters.html

每個元素可以指定一個URI和一個數據類型(MIME媒體類型)有單獨的屬性 - 模式,主機,端口和路徑 - 用於的每個部分。的URI:

方案://主機:端口/路徑

沒有參數或查詢字符串(?因此,標記之後的部分被簡單地不反對任何匹配的)

+3

只是想讓你知道,如果你確實想得到參數,你總是可以從「data」元素中解析出來,它會給你整個URI。使用getIntent()。getData()來獲取URI。 – PaulP