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()
}
}
}