Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

intent filter pathPrefix with question mark

Tags:

android

I want to set up an intent filter to handle urls like: http://mysite.com/?action=delete&id=30492

I've tried setting up my intent-filter as follows:

<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>

However, this doesn't work, and my app is not recognized as being able to handle the URL. I know that it's because I'm doing something wrong with my pathPrefix because when I remove the pathPrefix it works. I also know that it's related to having the question mark in there because if I remove the question mark from the URL and the pathPrefix, it works.

Do I need to escape the question mark in some way? I tried escaping with a slash (android:pathPrefix="/\?action=") but that doesn't work either.

How can I get this intent filter to work?

like image 345
Rico Yao Avatar asked Dec 02 '10 01:12

Rico Yao


1 Answers

Since Api 19 you can use sspPattern:

android:sppPrefix="//mysite.com/?action="

Do not forget remove android:host and android:pathPrefix

like image 193
Orgazm pionerki Avatar answered Sep 18 '22 23:09

Orgazm pionerki