[英]How to filter only specific URL with intent filter
I want to filter specific URL : http://gaapa.cz/mobile/ * 我想过滤特定网址: http : //gaapa.cz/mobile/ *
But this filter is fired on every URl - ehta's wrong with that? 但是这个过滤器会在每个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>
You want to either use path, pathPrefix
, or pathPattern
, according to the docs here. 您希望根据此处的文档使用path,
pathPrefix
或pathPattern
。
In your case, either pathPattern
or pathPrefix
will work, 在您的情况下,
pathPattern
或pathPrefix
将工作,
pathPattern="mobile/*"
or 要么
pathPrefix="mobile"
However, that does not explain why your filter is matching all URIs. 但是,这并不能解释为什么您的过滤器匹配所有URI。 it should be matching none since path does not understand "*".
它应该匹配none,因为路径不理解“*”。 i suspect there is something added / missing from somewhere else in your code.
我怀疑代码中的其他地方有添加/缺失的内容。
Try this: 尝试这个:
<data android:host="gaapa.cz"
android:pathprefix="mobile/"
android:scheme="http" />
This should work: 这应该工作:
<data android:host="gaapa.cz"
android:path="mobile"
android:pathPattern="*"
android:scheme="http" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.