Deep Linking — Setup for Android

JAA Consulting
2 min readFeb 17, 2023

--

This Part is for setting up DeepLink, this time for Android. I have written a post on how to set up Deep Link on iOS, and you can find the page here.

Setting up a deep link on android is very simple; you can do it manually or through the command.

Setup using command

To configure the external linking in Android, you can create a new intent in the manifest. The easiest way to do this is with the uri-scheme package:

npx uri-scheme add jlrecharge --android

RESULTED:
jalves@Justimianos-MacBook-Pro jlrecharge % npx uri-scheme add jlrecharge --android
› Android: Added URI protocol "jlrecharge" to project
jalves@Justimianos-MacBook-Pro jlrecharge %

Setup Manually

If you want to add it manually, open up SimpleApp/android/app/src/main/AndroidManifest.xml, and make the following adjustments:

  1. Set launchMode of MainActivity to singleTask to receive intent on existing MainActivity (this is the default, so you may not need actually to change anything).
  2. Add the new intent-filter inside the MainActivity entry with a VIEW type action:
  <activity 
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize"
android:exported="true">
<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="jlrecharge"/>
</intent-filter>
</activity>

Validate the Deep Linking

The adb command can be used as follows to test deep links with the Android emulator or a connected device:

adb shell am start -W -a android.intent.action.VIEW -d [your deep link] [your android package name]

For example:

adb shell am start -W -a android.intent.action.VIEW -d "jlrecharge://home" com.jlrecharge.dev

For Support or if you have any questions, please reach out.

If you have questions or need help, reach out — info@jaalves.com.

Collaboration:

DM on Instagram : https://www.instagram.com/jaa.consulting/

DM on Facebook: https://www.facebook.com/Jaa.Consulting.Official

--

--

JAA Consulting

Over decade of experience building software and support entire live-cycle of development.