composable(
route = NavRoutes.BusinessDetailPage.route,
arguments = listOf(navArgument("id") { type = NavType.StringType }),
// URI is your page deeplink in this case "awesomewebpage.com",
// get your uri from your desired configuration: const var, env, gradle, etc..
deepLinks = listOf(navDeepLink { uriPattern = "https://awesomewebpage.com/business/{id}"}),
) { backStackEntry ->
backStackEntry.arguments?.getString("id")?.run {
BusinessDetailPage(this)
} ?: run {
ErrorPage(message = "404")
}
}
Description
Note: To add deep links: Add the .well-known/assetlinks.json file to your server to register the app Check the documentation: Docs
To test deep link locally call with adb:
Note: Once you upload the app to Google Play Store you will find the .well-known/assetlinks.json file config in the signature menu
To verify the assetlinks.json was registered with the app use:
When verified, you should see the following output:
Navigations: Example of nav with arguments:
Example of calling a route with arguments:
To set deep links: