Android Intent Filter pathPattern排除url

时间:2013-09-30 22:36:01

标签: android android-intent android-manifest intentfilter

不确定这是否可行,但希望有人有解决方案。

我想让我的Android应用拦截mydomain.com/abc形式的网址但不是mydomain.com/mp3/id

使用pathPattern?

以某种方式可以排除某些路径
<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="mydomain.com" />
                <data android:pathPattern="/.*" /> />
        </intent-filter>

1 个答案:

答案 0 :(得分:0)

pathPattern更像glob,而不像regexp。如果你真的意味着mydomain / abc,你应该能够指定android:host =“mydomain.com”android:pathPattern =“abc”,但我的猜测是你的意思

匹配mydomain.com/x

不匹配mydomain / x / y

我不认为这是可能的。如果是,则可能涉及使用pathPrefix。