Deep-Linking in Jetpack Compose?????????Android

In this article, we’ll learn how to easily implement deep-linking in Jetpack Compose.

What is Deep-Linking?

Deep-linking allows users to navigate to specific content within an app directly from an external source, such as a website or another app.

Dependency

Go ahead to :app/build.gradle.kts and add the navigation dependency.

dependencies {
    implementation("androidx.navigation:navigation-compose:2.5.3")
}

Now let’s go back to the MainActivity.kt and setup the navigation.

Step 1

Create the navController.

val navController = rememberNavController()

Step 2

Create the NavHost and the screen.

NavHost(
    navController = navController,
    startDestination = "home"
) {

    composable(
        route = "home"
    ) {
        // ...
    }
}

Read More