Deep-Linking in Jetpack Compose — Android
<p>In this article, we’ll learn how to easily implement deep-linking in Jetpack Compose.</p>
<p><img alt="" src="https://miro.medium.com/v2/resize:fit:630/1*4vKhKWZiSav6q34qhfXVYQ.jpeg" style="height:394px; width:700px" /></p>
<h2>What is Deep-Linking?</h2>
<p><strong>Deep-linking</strong> allows users to navigate to specific content within an app directly from an external source, such as a website or another app.</p>
<h2>Dependency</h2>
<p>Go ahead to <code>:app/build.gradle.kts</code> and add the navigation dependency.</p>
<pre>
dependencies {
implementation("androidx.navigation:navigation-compose:2.5.3")
}</pre>
<p>Now let’s go back to the <code>MainActivity.kt</code> and setup the navigation.</p>
<h2>Step 1</h2>
<p>Create the <code>navController</code>.</p>
<pre>
val navController = rememberNavController()</pre>
<h2>Step 2</h2>
<p>Create the <code>NavHost</code> and the screen.</p>
<pre>
NavHost(
navController = navController,
startDestination = "home"
) {
composable(
route = "home"
) {
// ...
}
}</pre>
<p><a href="https://medium.com/@daniel.atitienei/deep-linking-in-jetpack-compose-android-f9a70d432896">Read More</a></p>