Android:使用IntentFilter处理链接

时间:2014-04-21 17:27:37

标签: android android-intent intentfilter

我在尝试使用IntentFilter处理以下链接时遇到了一些麻烦。

http://www.fakedomain.com/clubs/players/<playerId>/<hobbies>

现实生活中的例子如下:

http://www.fakedomain.com/clubs/players/999/21321321321#xXtor=ZQA-999-[hobbies_hobby]

这是我的IntentFilter

<activity
    ......>
    <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" android:host="www.fakedomain.com"
              android:path="/clubs/players/*" />
    </intent-filter>
</activity>

我试过跟随android:path&#39; s并且没有一个工作:

android:path="/clubs/players/.*/.*"

android:path="/clubs/players/*/*"

我能够处理以下链接

http://www.fakedomain.com/clubs/players/

但这是没用的,因为链接缺少完整路径。

我已经阅读了谷歌搜索中出现的其他几个例子,但我仍然无法处理这个链接,我可能会做一些完全愚蠢的事情。

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:1)

  

这是我的IntentFilter

android:path不接受通配符。那是android:pathPattern。无论如何,使用android:pathPrefix可能会更好。

相关问题