意图过滤pathPrefix与问号

Ric*_*Yao 11 android

我想设置一个意图过滤器来处理以下网址: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>
Run Code Online (Sandbox Code Playgroud)

但是,这不起作用,我的应用程序无法识别为能够处理URL.我知道这是因为我做错了我的错,pathPrefix因为当我删除pathPrefix它有效.我也知道这与在那里有问号有关,因为如果我从URL中移除问号pathPrefix,那就可以了.

我是否需要以某种方式逃避问号?我尝试使用斜杠(android:pathPrefix="/\?action=")转义,但这也无效.

如何让这个意图过滤器工作?

Com*_*are 13

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