其他分享
首页 > 其他分享> > android – 如何仅使用intent过滤器过滤特定的URL

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

作者:互联网

我想过滤特定网址: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>

解决方法:

根据the docs here.,您要使用path,pathPrefix或pathPattern

在您的情况下,pathPattern或pathPrefix将工作,

pathPattern="mobile/*"

要么

pathPrefix="mobile"

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

标签:android,intentfilter
来源: https://codeday.me/bug/20191007/1868383.html