Divyansh Kushwaha
11/22/2023, 9:46 AMACTION_LAUNCH_WITH_SYNC
(using a notification, to be specific).
But the issue is whenever I navigate to another screen and navigate back to the dashboard, ON_CREATE
is emitted again. It should only be called, whenever activity's onCreate is called, right?
DisposableEffect(Unit) {
val observer = LifecycleEventObserver { _, event ->
if (event == Lifecycle.Event.ON_CREATE) {
Timber.d("Dashboard: CREATED")
if (activity.intent.action == MainActivity.ACTION_LAUNCH_WITH_SYNC) {
viewModel.startDashboardSync(null)
}
}
}
activity.lifecycle.addObserver(observer)
onDispose {
lifecycleOwner.lifecycle.removeObserver(observer)
}
}
Alex
11/22/2023, 10:27 AMAlex
11/22/2023, 10:28 AMDivyansh Kushwaha
11/22/2023, 10:53 AMIan Lake
11/22/2023, 3:33 PM