You have a website and an android application and you want it so that an android user will be redirected to the application once they open a link from their email. Good thing android have an easy way to do this using Intents and Intent filters.

The first step is to add an information in your applications AndroidManifest.xml to tell the system that you want to received an intent regarding opened links. Open your AndroidManifest and add the following under the activity that you want to receive the intent.

<activity
 android:name=".MainActivity">
 <intent-filter>
 <action android:name="android.intent.action.MAIN" />
 <category android:name="android.intent.category.LAUNCHER" />
 </intent-filter>
 <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:scheme="http" android:host="www.jamesbaltar.com"/>
 </intent-filter>
</activity>

What this does is tell android that your activity can handle and process links that was opened by users. Now everytime a user opens a link to www.jamesbaltar.com a popup window will appear showing a list of applications that can process the link this includes browsers installed, your application and some application that have also registered for this.

Continue reading