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
How to Filter Specific Apps For Action_Send Intent (And Set a Different Text For Each App)
Difference Between Getcontext() , Getapplicationcontext() , Getbasecontext() and "This"
Changing Locale Within the App Itself
How to Change Fontfamily of Textview in Android
What Permission Do I Need to Access Internet from an Android Application
How to Install Google Play Services in a Genymotion Vm (With No Drag and Drop Support)
Android Gallery on Android 4.4 (Kitkat) Returns Different Uri For Intent.Action_Get_Content
Re-Launch of Activity on Home Button, But...Only the First Time
How to Handle Button Clicks Using the Xml Onclick Within Fragments
Android Accelerometer Accuracy (Inertial Navigation)
Determining the Current Foreground Application from a Background Task or Service