如何在Android意向过滤器中执行否定匹配? [英] How can I perform a negative match in Android intent filter?

查看:74
本文介绍了如何在Android意向过滤器中执行否定匹配?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android清单中,如何在android:pathPattern中使用否定匹配?

如果可能的话,我想使用一个pathPattern来匹配所有URL 上的特定主机名.

解决方案

看来这是不可能的-实际上,似乎不是 这样设计的.我怀疑<intent-filter>对于您尝试做的事情都是错误的工具.

即使您可以使用android:pathPattern指定主机名(不是android:host的目的吗?),它也不是正则表达式,而是glob.根据 docs 的说法,出于安全原因,该功能故意不足.

In an Android manifest, how can I use a negative match in the android:pathPattern?

I'd like to use a pathPattern that matches on all URLs except for a specific hostname, if it's possible.

解决方案

It doesn't look like that's possible--in fact, it seems to be designed not to work that way. I suspect <intent-filter> is the wrong tool for whatever you're trying to do.

Even if you could use android:pathPattern to specify the hostname (isn't that what android:host is for?), it's more of a glob than a regex; according to the docs, it's deliberately underpowered for security reasons.

这篇关于如何在Android意向过滤器中执行否定匹配?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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