How to open an installed app from an email URL in Android?

Roadies picture Roadies · Sep 26, 2014 · Viewed 75.8k times · Source

I want to open my app from an email URL, basically like the example shown below for Twitter.com.

Email with link:

Email with link

Selection to open app or browser:

Select app or browser

After you click on the app choice, the Twitter app opens:

Open Twitter app

I tried the following code, but it is not working:

<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.twitter.com" android:scheme="http"></data>
</intent-filter>

If anyone has a proper answer, please write some examples here.

Answer

hemu picture hemu · Sep 26, 2014

The following code worked for me:

<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.my.app.com"
        android:path="launch"
        android:scheme="http"></data>
</intent-filter>

With the email link set as http://www.my.app.com/launch.

Ref: Launching Android Application from link or email