Deep Link Implementation in Jetpack Compose — Navigation + App Links
Deep linking allows users to navigate directly to specific screens via URLs. Jetpack Compose Navigation supports both implicit deep links (App Links) and URI pattern matching.
Define Deep Links in NavHost
NavHost(navController, startDestination = "home") {
composable(
route = "detail/{id}",
deepLinks = listOf(navDeepLink {
uriPattern = "https://myapp.com/detail/{id}"
action = Intent.ACTION_VIEW
})
) { backStackEntry ->
val id = backStackEntry.arguments?.getString("id")
DetailScreen(id)
}
}
Verify App Links in AndroidManifest.xml
<activity android:name=".MainActivity">
<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="myapp.com"/>
</intent-filter>
</activity>
Deep links improve user retention by enabling direct content access.
8 production-ready Android app templates on Gumroad.
Browse templates → Gumroad
Top comments (0)