Android, open application on click of a URL.

Add following code in your AndroidManifest.xml tag.

        <action android:name="android.intent.action.VIEW" />

        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />

        <data android:host="" />
        <data android:scheme="https" />
        <data android:scheme="http" />
        <data android:pathPattern=".*" />

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="">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.


One comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s