viewModelScope not cancelled
问题 After watching Sean's explanation on Android (Google I/O'19) I've tried the same: init{ viewModelScope.launch { Timber.i("coroutine awake") while (true){ delay(2_000) Timber.i("another round trip") } } } Unfortunately onCleared it's called when the activity is killed but not when it's put in background ("when we move away from the Activity...", background is "moving away" imho ^^). And I get the following output: > ---- Activity in Foreground > 12:41:10.195 TEST: coroutine awake > 12:41:12