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?
Since Api 19 you can use sspPattern:
android:sppPrefix="//mysite.com/?action="
Do not forget remove android:host and android:pathPrefix
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With