application

Android, open application on click of a URL.


Add following code in your AndroidManifest.xml tag.

    <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.put-your-website.com" />
        <data android:scheme="https" />
        <data android:scheme="http" />
        <data android:pathPattern=".*" />
    </intent-filter>

Once the activity is launched, getIntent().getData() will give the URL for which your application was launched.

As per the above intent-filter. If the webpage contains

<a href="http://www.put-your-website.com/any/path/to/open">Launch Application</a>

Click on this anchor would ask you to open the url in either browser or your application. In case your application is not installed on device, this url will continue to load in browser.