Peter Enyedi
12/15/2023, 3:18 PMLaunchedEffect
, which is polling a connected device every 5 seconds. When I put the app in the background and later bring back in the foreground, the LaunchedEffect
starts again, but as far as I can see, the original is also still running.
LaunchedEffect(Unit) {
while (true) {
viewModel.doSomething()
delay(5.seconds)
}
}
How can I prevent the polling duplicating itself in this case?Chrimaeon
12/15/2023, 4:31 PMChrimaeon
12/15/2023, 4:33 PMPeter Enyedi
12/15/2023, 4:35 PM