For viewModels we can use
viewModelScope.launch {
//long running operation
}
this is the proper way for viewModel.
Same like this, what's the best way to launch coroutines in Activity?
I used GlobalScope launch in Activity, is it right approach?
GlobalScope.launch {
}
For activities you should use lifecycleScope
Read more about it in the official documentation:
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments