如何仅使用intent过滤器过滤特定URL

Hur*_*rda 10 android intentfilter

我想过滤特定网址:http://gaapa.cz/mobile/*

但是这个过滤器会在每个URl上被触发 - ehta错了吗?

<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="gaapa.cz"
                android:path="/mobile/.*"
                android:scheme="http" />
</intent-filter>
Run Code Online (Sandbox Code Playgroud)

Jef*_*man 12

你想要使用路径pathPrefix,或者pathPattern,根据,

pathPattern="mobile/*"
Run Code Online (Sandbox Code Playgroud)

在您的情况下,无论是pathPatternpathPrefix将工作,

pathPrefix="mobile"
Run Code Online (Sandbox Code Playgroud)

要么

pathPattern="mobile/*"
Run Code Online (Sandbox Code Playgroud)

但是,这并不能解释为什么您的过滤器匹配所有URI.它应该匹配none,因为路径不理解"*".我怀疑代码中的其他地方有添加/缺失的内容.