Android Respond to Url in Intent

Android Respond To URL in Intent

I did it! Using <intent-filter>. Put the following into your manifest file:

<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:host="www.youtube.com" android:scheme="http" />
</intent-filter>

This works perfectly!

Responding to URL other than Google

IN INTENT FILTER CHANGE THE HOST TO YOUR HOST URL

<intent-filter>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:host="www.youtube.com" android:scheme="http"></data>
</intent-filter>

How to handle an Action View Intent inside my own app

This combined with code of the Lightning browser in the Android manifest found my solution. Thanks!

Intercepting links from the browser to open my Android app

Make Intent Filter only respond to external links

So my question is, is there a way for the intent filter to only respond to links outside of the app?

No.

You need to fix the way that you are creating links inside of your app, such that they do not attempt to launch an activity with an implicit Intent if the link matches your desired pattern, but instead handles the link inside your app.

How to filter only specific URL with intent filter

You want to either use path, pathPrefix, or pathPattern, according to the docs here.

In your case, either pathPattern or pathPrefix will work,

pathPattern="mobile/*"

or

pathPrefix="mobile"

However, that does not explain why your filter is matching all URIs. it should be matching none since path does not understand "*". i suspect there is something added / missing from somewhere else in your code.



Related Topics



Leave a reply



Submit