Android Navigation
ASecurityHandle a web App Link in two places: the Android manifest makes the activity a candidate for the incoming URL, and the Compose `NavHost` maps that URL to a typed destination. The app needs the `androidx.navigation:navigation-compose` dependency. Define the destination pattern centrally and validate the argument before loading content: ```kotlin sealed class Screen { data object ProductList : Screen() { val route = "products" } data object ProductDetail : Screen() { const val route = "product/...
- 584 stars
- 0 votes
- 0 copies
- 3 views
- Added September 5, 2026
Security analysis
100/100Pro scans all 18 files and shows the line behind each finding
npx -y skills add HoangNguyen0403/agent-skills-standard --skill android-navigation --agent claude-codeAre you the author of Android Navigation?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/hoangnguyen0403-android-navigation-68fa055c)Handle a web App Link in two places: the Android manifest makes the activity a candidate for the incoming URL, and the Compose `NavHost` maps that URL to a typed destination. The app needs the `androidx.navigation:navigation-compose` dependency.
Define the destination pattern centrally and validate the argument before loading content:
```kotlin
sealed class Screen {
data object ProductList : Screen() {
val route = "products"
}
data object ProductDetail : Screen() {
const val route = "product/{productId}"
const val argument = "productId"
}
}
@Composable
fun AppNavHost() {
val navController = rememberNavController()
NavHost(
navController = navController,
startDestination = Screen.ProductList.route,
) {
composable(
route = Screen.ProductDetail.route,
arguments = listOf(
navArgument(Screen.ProductDetail.argument) {
type = NavType.LongType
},
),
deepLinks = listOf(
navDeepLink {
uriPattern = "https://example.com/product/{productId}"
},
),
) { entry ->
val id = entry.arguments
?.takeIf { it.containsKey(Screen.ProductDetail.argument) }
?.getLong(Screen.ProductDetail.argument)
if (id == null || id <= 0L) {
InvalidProductLinkScreen()
return@composable
}
// The detail route must still show NotFound if this ID is absent.
ProductDetailRoute(productId = id)
}
}
}
```
Add the matching intent filter to the activity in `AndroidManifest.xml`:
```xml
<activity
android:name=".MainActivity"
android:exported="true">
<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="example.com"
android:pathPrefix="/product" />
</intent-filter>
</activity>
```
For verified HTTPS App Links, publish `https://example.com/.well-known/assetlinks.json` with the app package name and the SHA-256 fingerprint of the signing certificate. The URI pattern, manifest host/path, and asset-links domain must agree. If the activity uses `singleTop` and receives a new intent while already running, forward that intent to the `NavController` with `handleDeepLink` (or let the app’s existing Navigation host integration do so); do not manually parse the URL into an arbitrary route.
Files in this skill
- eval-1.baseline.md
- eval-1.with-skill.md
- eval-2.baseline.md
- eval-2.with-skill.md
- eval-3.baseline.md
- eval-3.with-skill.md
- trigger-1.md
- trigger-10.md
- trigger-11.md
- trigger-2.md
- trigger-3.md
- trigger-4.md
- trigger-5.md
- trigger-6.md
- trigger-7.md
- trigger-8.md
- trigger-9.md
Attribution
Related skills
View all in development →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.