eygraber
12/14/2022, 8:26 AMCoroutineScope
used by LaunchedEffect
?
If I run the following, then the logs get printed even after my Activity stops:
LaunchedEffect(Unit) {
while(true) {
Log.e("TEST", System.currentTimeMillis().toString)
delay(1_000)
}
}
Tash
12/14/2022, 8:35 AMisActive
otherwise this coroutine won’t support cancellation?
LaunchedEffect(Unit) {
while(isActive) {
Log.e("TEST", System.currentTimeMillis().toString)
delay(1_000)
}
}
eygraber
12/14/2022, 8:59 AMdelay
would handle cancellationStylianos Gakis
12/14/2022, 9:33 AMrepeatOnLifecycle
API inside there? You can fetch the lifecycle outside of the LaunchedEffect using the composition local of lifecycleeygraber
12/14/2022, 9:34 AMStylianos Gakis
12/14/2022, 9:37 AMeygraber
12/14/2022, 9:39 AMStylianos Gakis
12/14/2022, 9:40 AMeygraber
12/14/2022, 9:47 AMStylianos Gakis
12/14/2022, 9:52 AM