Part 2: Universal & Deep Links | Android Setup

Niranjan Shakya
3 min read

Universal Links functionally allows you to have a single link to open your app or mobile site. For a detailed first part of this blog, click here, so not forget to come back.

Android devices utilize a similar concept as universal link known as Android App Links, enabling apps to handle web URLs and provide a cohesive user experience across platforms. Check this!

Here's how to begin with the Setup:

  1. Add the necessary intent filters to your app’s manifest file. Here’s an example of what the intent filters might look like:
<activity android:name=".MainActivity"> 
    <action android:name="android.intent.action.VIEW"/> 
    <category android:name="android.intent.category.DEFAULT"/> 
    <category android:name="android.intent.category.BROWSABLE"/> 
    <data android:scheme="https" android:host=""/> 
  1. Create a Digital Asset Links file on your web server. This file should contain JSON data that describes the relationship between app and website. The JSON data should include your app’s package name and the SHA-256 fingerprint of your app’s signing key.

Here’s an example of what the JSON data might look like:

    "relation": ["delegate_permission/common.handle_all_urls"],
    "target": {
      "namespace": "android_app",
      "package_name": "dev.example",
      "sha256_cert_fingerprints": ["CA:25:F8:BC:AA:BB:69:69:69:CB:9B:1F:2F:3F:4F:5F:6F:7F:66:77:46:23:36:8B:13:E5:5C:EC:D2:F7:9A:B7"]
  1. Upload the Digital Asset Links file to the root directory of your web server.
  2. Test the Universal Links by clicking on a link to website in a web browser on an Android device. If everything is set up correctly, your app should open automatically.

Android App links use the Digital Asset Links API to establish trust that your app has been approved by the website to automatically open links for that domains. App link is a special type of deep link that allows your website URL to immediately open corresponding content in your Android app

To verify that you own both app and the website URLs, complete the following steps:

  1. Add intent filters that contain the autoVerify attribute. This attribute signals to the system that it should verify whether your app belongs to the URL domains used in your intent filters.
  2. Declare the association between your website and your intent filters by hosting a Digital Asset Links JSON file at the following location:

For the for further more debugging see here.

Deep links are URIs of any scheme that take users directly to a specific part of your app.

To create deep links:

  1. Add intent filters to drive users to the right activity in your app, as shown in the following code snippet:
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="something" />
  1. When the user clicks a deep link, a dialog might appear. This dialog allows the user to select one of multiple apps, including your app, that can handle the given deep link.
  1. You can use the Android Debug Bridge with the activity manager (am) tool to test that the intent filter URIs you specified for deep linking resolve to the correct app activity.
  2. You can run the ADB command against a device or an emulator.

The general syntax for testing an intent filter URI with adb is:

$ adb shell am start -W -a android.intent.action.VIEW -d <URI> <PACKAGE>

Manual verification process:

  1. To perform domain verification, your device must be connected to the internet. You can manually enable the verification process. To do so, run the following command in a terminal:

adb shell am compat enable 175408749 PACKAGE_NAME

  1. Before manually invoking domain verification on a device, you must reset the state of Android App Links on the test device. To do so, run the following command in a terminal window:

adb shell pm set-app-links --package PACKAGE_NAME 0 all

  1. This command restores the device to its state before the user chooses default apps for any domains.

Invoke the domain verification process:

  1. After you reset the state of android app links on a device, you can perform the verification itself. Run this command in terminal:

adb shell pm verify-app-link –re-verify PACKAGE_NAME

  1. Wait for the verification agent to finish its request, review the verificataion results. Run this command:

adb shell pm get-app-link PACKAGE_NAME

  1. The output of this command is similar to the following:
    ID: 01234567-89ab-cdef-0123-456789abcdef
    Signatures: [***]
    Domain verification state: verified legacy_failure verified 1026

Fantasy Euro Cup Matches are Up  

Click here for details