I am trying to intercept a couple different links with my app, and I am having trouble with the intent-filter data parameters to do it.
Here are the 2 types of links that I want to intercept
I have already decided to have a separate activity to intercept both links and use java regex to start the correct activity. However I can't seem to capture just these two formats without capturing something like http://www.domain.com/abc123
<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="www.domain.com"
android:pathPattern="/#id.*" />
</intent-filter>
This is what I am currently trying to intercept type 1 and for some reason it isn't working.
This intent-filter correctly intercepts type 2
<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" />
<data android:host="domain.com" />
<data android:host="www.domain.com" />
<data android:pathPrefix="/share/web" />
<data android:pathPrefix="/social/landing" />
</intent-filter>
Thanks,
I think that the string that pathPattern is matching is "/", and "#id..." is omitted because it is part of the fragment. If you used http://www.domain.com/id/abcdef123456 instead, pathPattern could match "/id/.*" because it is part of the path.