[FIXED] what is the maximum job execution time of onHandleWork() of JobIntentService?


I am encountering a SecurityException crash on Android 8 with targetSDK 26 when using JobIntentService.

This is from JobIntentService docs:

enter image description here

So What is the maximumJobExecution time limit – and if we exceed it – will it possible that a SecurityException will be thrown?

Security Exception issue tracker



I’ve manually tested it, the maximum execution time is 600 seconds, which means 10minutes. What happens next, is the JobIntentService gets destroyed, then re-created to resume the rest of the work. This has been tested from Android Marshmallow to Android Oreo . I also haven’t experienced any thrown exception, I’m also using Thread.sleep() method to simulate a long process.

Update 1:
I’ve noticed, that after a while the service stops or Android puts it to sleep. So let’s say, you’re doing constant checks in the background i.e. API calls to get latest data to push notifications. It works for a while, then stops after a day or 2. I’m not sure why it randomly stops.

Answered By – Desolator

Answer Checked By – Senaida (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published