I am launching coroutine in activity onCreate like below(for understanding more on coroutines)
CoroutineScope(Dispatchers.IO).launch {
for (i in 0 until 10000)
{
delay(500)
LogUtils.debug("Coroutine", "Coroutine_Scope")
}
}
GlobalScope.launch {
for (i in 0 until 10000)
{
delay(500)
LogUtils.debug("Coroutine", "Global_Scope")
}
}
Now going from activity A to other activities in application without cancelling the coroutines. Now both the coroutines are running in background. I know globalscope will run till application is killed. But why coroutinescope is running? what is the exact difference between CoroutineScope(Dispatchers.IO).launch vs GlobalScope.launch ? For me both looks similar