How to Create Deep Links for App Content in Android Studio

In the context of mobile apps, deep linking consists of using a uniform resource identifier (URI) that links to a specific location within a mobile app rather than simply launching the app. Deferred deep linking allows users to deep-link to content

How to Create Deep Links for App Content in Android Studio
Enable deep links for App content in Android Studio Apps, fist of all you have to add intent filters for the relevant or main activities in your android application manifest.xml file. The intent filters allow deep linking to the content in any of your activities chosen.

Add intent filters for incoming links

To create a link to your app content, add an intent filter that contains these elements and attribute values in your manifest:
Specify the ACTION_VIEW intent action so that the intent filter can be reached from Google Search.
Add one or more  tags, each of which represents a URI format that resolves to the activity. At a minimum, the tag must include the attribute.
You can add more attributes to further refine the type of URI that the activity accepts. For example, you might have multiple activities that accept similar URIs, but which differ simply based on the pathname. In this case, use the android:path attribute or its pathPattern or pathPrefix variants to differentiate which activity the system should open for different URI paths.
Include the BROWSABLE category. It is required in order for the intent filter to be accessible from a web browser. Without it, clicking a link in a browser cannot resolve to your app.
Also, include the DEFAULT category. This allows your app to respond to implicit intents. Without this, the activity can be started only if the intent specifies your app component name.
The following XML snippet shows how you might specify an intent filter in your manifest for deep linking. The URIs “example://gallery” and “” both resolve to this activity.
    <intent-filter android:label="@string/MyAppName">
        <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="" android:pathPrefix="/gallery"/>    intent-filter>

Now Read Data from Incoming Intents in

Once the Android system starts the routed activity through an intent filter. You can get the data bundle from Intent to determine what you which activity or fragment to render. Call the getData() and getAction() methods to retrieve the data and action associated with the incoming Intent. You can call these methods at any time during the lifecycle of the activity, but you should generally do so during early callbacks such as onCreate() or onStart().
The following code snippet shows how to retrieve data from an Intent
public void onCreate(Bundle savedInstanceState) {

    Intent intent = getIntent();
    String action = intent.getAction();
    Uri data = intent.getData();

How to Test your deep links:

The general syntax for testing an intent filter URI with ADB is:
$ adb shell am start
        -W -a android.intent.action.VIEW
$ adb shell am start
        -W -a android.intent.action.VIEW
        -d "example://gallery"