gpt4 book ai didi

android - 带问号的 Intent 过滤器路径前缀

转载 作者:塔克拉玛干 更新时间:2023-11-01 22:02:08 26 4
gpt4 key购买 nike

我想设置一个 Intent 过滤器来处理像这样的 url: http://mysite.com/?action=delete&id=30492

我已尝试按如下方式设置我的 intent-filter:

<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:scheme="http" android:host="mysite.com" android:pathPrefix="/?action="/>
</intent-filter>

但是,这不起作用,我的应用无法处理该 URL。我知道这是因为我的 pathPrefix 做错了,因为当我删除 pathPrefix 时它起作用了。我也知道它与其中的问号有关,因为如果我从 URL 和 pathPrefix 中删除问号,它就会起作用。

我需要以某种方式转义问号吗?我尝试使用斜杠 (android:pathPrefix="/\?action=") 进行转义,但这也不起作用。

如何让这个 Intent 过滤器发挥作用?

最佳答案

查询字符串(在您的示例中为 ?action=...)不是路径的一部分。 AFAIK,您不能过滤查询字符串。

关于android - 带问号的 Intent 过滤器路径前缀,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4330806/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com