person using MacBook Pro

1. The Three Tiers of Android Deep Linking

In modern mobile app architecture, deep linking allows external sources—such as marketing emails, SMS messages, QR codes, and search engine results—to launch your application and navigate directly to a specific product, article, or user profile rather than opening the generic home screen.

Android supports three distinct tiers of deep linking:

  • Custom URI Schemes (e.g. myapp://product/123): Simple custom protocols configured in the manifest. While widely supported, they trigger disambiguation popups if multiple apps register the same scheme.
  • Standard Web Deep Links (HTTP/HTTPS): Standard URLs that present the Android “Open with” app chooser dialog.
  • Android App Links (Verified HTTPS): The gold standard of deep linking. By hosting an encrypted assetlinks.json file on your domain, Android automatically opens your verified app without displaying any chooser dialog.

2. Configuring Intent Filters in AndroidManifest.xml

To register your application as an authorized handler for your web domain, an <intent-filter> with the android:autoVerify="true" attribute is declared in the manifest:

<activity android:name=".MainActivity" android:exported="true">
    <intent-filter android:autoVerify="true">
        <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="yourwebsite.com" />
    </intent-filter>
</activity>

4. Routing Incoming URLs Inside Android WebView

When a user clicks a link and launches your app, the Android Activity captures the incoming Intent URI and routes it to the WebView:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    
    Intent intent = getIntent();
    Uri data = intent.getData();
    if (data != null) {
        // Load deep link URL directly inside WebView
        webView.loadUrl(data.toString());
    } else {
        webView.loadUrl("https://yourwebsite.com");
    }
}

Leave a Reply

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