Reputation: 4394
I want to create an activity that opens only when links with a specific URL are clicked. For example: i want to open http://mysite.xyz/test?param=val#myid=12345 with my app (activity), but http://mysite.xyz/test?other=stuff i want to be opened with default browser.
I'm trying to create an intent filter like this:
<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.xyz"
android:pathPattern="????" />
...
</intent-filter>
My problem is that android:pathPattern or pathPrefix do not (seam to) verify the query string (any text after the ? or the last /). Is there a solution for this filtering ?
Upvotes: 0
Views: 1627
Reputation: 31
You can use android:ssp, android:sspPrefix and android:sspPattern attributes. But it works only in 4.4 and higher.
Upvotes: -1
Reputation: 26
I haven't tried it myself, but I think you can handle the links based on the URL path, up to the "?" or the last "/". Then, in your activity, check the last part (after ? or last /) and if it doesn't match your criteria, you can redirect the user back to the default browser.
Upvotes: 1