Hello! Based on <some discussion here> and this <a...
# coroutines
Hello! Based on some discussion here and this article, I decided to use injected scopes in some ViewModels to ensure that my job is not cancelled due to its lifecycle. However, I’m facing another issue now: sometimes when the app stays some time in the background, the scope is finished. Then all successive calls are not executed. In order to inject the scope, I’m using Koin like this:
Copy code
single(qualifier = ApplicationScope) { MainScope() }
And using it like this:
Copy code
internal class MyViewModel(private val applicationScope: CoroutineScope) : ViewModel() {

    fun addTask() {
        applicationScope.launch {
            // Suspend fun
Shouldn’t this scope be available until the application is killed or am I missing something? Thank you so much in advance! EDIT: SOLVED
Solved: I had a
call in a very hidden position in my codebase. 🙃