Jabez Magomere
02/05/2020, 6:43 AMtseisel
02/05/2020, 7:41 AMclass MyService : Service(), CoroutineScope by MainScope()
But you could also use composition :
class MyService : Service() {
private val scope = MainScope()
}
In either case, don't forget to cancel the scope in onDestroy.louiscad
02/05/2020, 8:30 AMLifecycleService
from AndroidX Lifecycle Service and use lifecycleScope
.Manuel Vivo
02/05/2020, 10:02 AMlifecycleScope
. A service should have a scope, not be a scopevoben
02/05/2020, 4:05 PMonDestroy
method?