I have a question, it's clearly my misunderstandin...
# coroutines
m
I have a question, it's clearly my misunderstanding, but, I have a JobCancellation on my Workers ($doWork: kotlinx.coroutines.JobCancellationException: Job was cancelled;) Only when my screen is off. If the app is the background or if we are on the app. No problems.
i
Your jobs will get cancelled if your constraints are no longer met or if JobScheduler's maintenance period ends, that's perfectly normal (and your job will be set to RETRY automatically when cancelled this way)
m
Yes I understand that, but I don't know or see a screen off constraint..
i
Keep in mind that in light doze (the state that your device goes into shortly after the screen is turned off), the maintenance windows for doing work while the screen off are very short (~a minute): https://developer.android.com/training/monitoring-device-state/doze-standby#understand_doze
You shouldn't be attempting to handle any CancelationException directly. That's true for any suspending function
👍 1
m
Ok thanks a lot.