Run Coroutine with delay in doze mode

43 views Asked by At

I am trying to implement an idle time lock feature. Has coroutine had some restrictions in doze mode? As delay doesn't seem to work once the device is in doze mode

var scope: CoroutineScope = MainScope()

fun scheduleIdleTimer(time: Long) {
    scope.coroutineContext.cancelChildren()
    scope.launch {
        delay(time)
        if (isActive) {
            initiateIdleLock()
        }
    }
}
0

There are 0 answers