Java – Launch Android applications using deep linking

Launch Android applications using deep linking… here is a solution to the problem.

Launch Android applications using deep linking

I’m trying to launch my Android app with deep links. Basically, the user receives an email with a link, and when the user clicks on the link, the application should launch.
I know how to do basic deep linking, however, I want to launch the actual application and not just a specific activity. My deep linking scheme is similar to “mydeeplinking” and “mydeeplinking://” in email.
I’m looking for something similar to iOS deep linking that launches the entire app.
Any help would be appreciated.
Thanks in advance.

Solution

Basically, all you need to do is use intent-filter to tell Android what type of data it should route to your app.

AndroidManifest.xml:

<activity android:name="com.example.MainActivity" >

<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" />
        <data android:scheme="https" />

<data android:host="www.example.com" />

<data android:path="/" />
        <data android:path="/map" />

</intent-filter>

</activity>

This will launch your MainActivity when the user clicks any of the following links:

http://www.example.com/
https://www.example.com/
http://www.example.com/map
https://www.example.com/map

Related Problems and Solutions