Track Jetpack Compose
Use FnObserveNavigationController and FnObserveThisNavBackStackEntry to allow Finotes to track lifecycle events of Jetpack compose screens.
Step 1: Pass your navigationController object to FnObserveNavigationController API.
Step 2: Call FnObserveThisNavBackStackEntry API within each screen of your NavHost.
Once done the lifecycle events of Jetpack Compose screens will be added to the ActivityTrail.
Kotlin Code:
- Kotlin
val navigationController = rememberNavController()
NavHost(navController = navigationController, startDestination = "HomeScreen") {
composable("HomeScreen") {
HomeScreen()
FnObserveThisNavBackStackEntry()
}
composable("ProfileScreen") {
ProfileScreen()
FnObserveThisNavBackStackEntry()
}
composable("SettingsScreen") {
SettingsScreen()
FnObserveThisNavBackStackEntry()
}
}
FnObserveNavigationController(navController = navigationController)