如何筛选只有特定的URL与意图过滤器 [英] How to filter only specific URL with intent filter

查看:148
本文介绍了如何筛选只有特定的URL与意图过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要过滤特定的URL: http://gaapa.cz/mobile/ *

但这种过滤器上发射的每个URL - ?ehta的错

 <意向滤光器>
            <作用机器人:名称=android.intent.action.VIEW/>

            <类机器人:名称=android.intent.category.DEFAULT/>
            <类机器人:名称=android.intent.category.BROWSABLE/>

            <数据
                机器人:主机=gaapa.cz
                机器人:路径=/移动/.*
                机器人:计划=HTTP/>
&所述; /意图滤光器>
 

解决方案

你想

要么使用路径,路径preFIX,或pathPattern据, <一href="http://developer.android.com/guide/topics/manifest/data-element.html#path">http://developer.android.com/guide/topics/manifest/data-element.html#path

在你的情况,无论是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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆