Android Deep Link URL to App Activity Tutorial

Android provide deep links open a specific activity within an app with data to it. Deep link is very useful because user able to navigate website URL to the specific activity in the app instantly to get better user experiences. Besides, it may also particularly useful for actions, such as clicking a notification or sending an app link via email or messaging. When the user clicks the email notification she/he received, it opens a deep link that takes her/his to the email in the app. Deep links also allow Google to index your app and link to specific sections of your app in searches engine. In this tutorial, I will teach you how to use the android deep link in your project.

Creating a New Project

1. Open Android Studio IDE in your computer.
2. Create a new project and Edit the Application name to “DeepLinkExample”.
(Optional) You can edit the company domain or select the suitable location for current project tutorial. Then click next button to proceed.
3. Select Minimum SDK (API 15:Android 4.0.3 (IceCreamSandwich). I choose the API 15 because many Android devices currently support more than API 15. Click Next button.
4. Choose “Empty Activity” and Click Next button
5. Lastly, press finish button.

Edit AndroidManifest.xml

Add intent filter action VIEW and category DEFAULT + BROWSABLE in the MainActivity to activate Deep Link feature. Besides, add host and schema inside the intent filter section.

Edit MainActivity.java class

Go to your MainActivity class and create a method name “handle” to get intent from the deep link. onNewIntent is for activity “singleTop”, so it will not open duplicated activity and call the onCreate method again.

Run Your Project

Lastly, you can now run your project in your device or emulator.

Test Your Deep Link

Open your terminal and insert the following command.

  1. set PATH=%PATH%;C:\Users\(USERNAME)\AppData\Local\Android\sdk\platform-tools (if adb not found)
  2. adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d “//www.example.com/gizmos”

Android Deep Link URL to App Activity

Source Code

(Visited 130 times, 1 visits today)
Advertisements

Kristofer Ng

A crazy android and web developer. Passion on developing android application and exploring new technology as a hobby.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

GET YOUR EBOOK FOR FREE

Unlock free ebook "Beginning Programming ALL-IN-ONE Desk Reference for DUMMIES" now!

We will send a copy to your email