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,
To open a URL/website you do the following: String url = "http://www.example.com"; Intent i = new Intent(Intent. ACTION_VIEW); i.
An intent filter is an expression in an app's manifest file that specifies the type of intents that the component would like to receive. For instance, by declaring an intent filter for an activity, you make it possible for other apps to directly start your activity with a certain kind of intent.
content. intent' is deprecated. I found some threads regarding the usage of getIntent() but I am creating a new intent in my case in a RecyclerViewAdapter to open a new Activity.
By using Android Debug Bridge (ADB) shell commands one can test the deep link flow. It is used to verify if the link navigates to the correct section of your app. This command starts the ADB shell with the VIEW action and specifies the deep link URL to be tested.
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.
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