DEV Community

myougaTheAxo
myougaTheAxo

Posted on

Android App Links & Deep Links: Intent Filters and Digital Asset Links

Android App Links & Deep Links: Intent Filters and Digital Asset Links

Deep links are URIs that navigate directly to specific content within your app. App Links allow your app to be the default handler for certain web URLs, improving user experience and app discovery.

Intent Filters

Intent filters define what types of requests your activity can handle. For deep links, specify the scheme, host, and path:

<activity android:name=".DetailActivity">
    <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="https"
            android:host="example.com"
            android:path="/detail/*" />
    </intent-filter>
</activity>
Enter fullscreen mode Exit fullscreen mode

Digital Asset Links

To make your app the default handler for web URLs, create a JSON file at /.well-known/assetlinks.json:

[{
    "relation": ["delegate_permission/common.handle_all_urls"],
    "target": {
        "namespace": "android_app",
        "package_name": "com.example.app",
        "sha256_cert_fingerprints": ["AA:BB:CC:DD:..."]
    }
}]
Enter fullscreen mode Exit fullscreen mode

Handling Deep Links in Code

val uri = intent.data ?: return
val detailId = uri.lastPathSegment
Enter fullscreen mode Exit fullscreen mode

Deep links strengthen your app's presence in the Android ecosystem and improve discoverability. They create seamless navigation experiences between web and app contexts.


8 Android app templates available on Gumroad

Top comments (0)