如何筛选只有特定的URL与意图过滤器 [英] How to filter only specific URL with intent filter
问题描述
我要过滤特定的URL: http://gaapa.cz/mobile/ *
但这种过滤器上发射的每个URL - ?ehta的错
<意向滤光器>
<作用机器人:名称=android.intent.action.VIEW/>
<类机器人:名称=android.intent.category.DEFAULT/>
<类机器人:名称=android.intent.category.BROWSABLE/>
<数据
机器人:主机=gaapa.cz
机器人:路径=/移动/.*
机器人:计划=HTTP/>
&所述; /意图滤光器>
解决方案
你想
在你的情况,无论是pathPattern或路径preFIX会的工作,
pathPattern =移动/ *
或
路径preFIX =移动
不过,这并不能解释为什么你的过滤器匹配的URI。应当匹配无因为路径不理解*。我怀疑有一些添加/从别的地方在你的code丢失。
I want to filter specific URL : http://gaapa.cz/mobile/*
But this filter is fired on every URl - ehta's wrong with that?
<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, http://developer.android.com/guide/topics/manifest/data-element.html#path
in your case, either pathPattern or pathPrefix would work,
pathPattern="mobile/*"
or
pathPrefix="mobile"
however, that does not explain why your filter is matching all URIs. it should be matching none since path does not understand "*". i suspect there is something added / missing from somewhere else in your code.
这篇关于如何筛选只有特定的URL与意图过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!