question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v1.1.11 exact jobs firing with delay on Doze Mode

See original GitHub issue

Hi, I’m trying to run an exact job 2min after it was scheduled but it has some delay when testing it with doze.

new JobRequest.Builder(GeofenceLimboJob.TAG).setExact(TimeUnit.MINUTES.toMillis(2)).setUpdateCurrent(true).build().schedule();

10-03 11:10:33.366 5502-14196/ D/JobProxy14: Scheduled alarm, request{id=15, tag=job_geofence_limbo_tag}, delay 00:02:00, exact true, reschedule count 0 10-03 11:14:24.707 5502-20670/ D/PlatformAlarmService: Run job, request{id=15, tag=job_geofence_limbo_tag}, waited 00:03:51, delay 00:02:00 10-03 11:14:24.727 5502-20670/ I/JobExecutor: Executing request{id=15, tag=job_geofence_limbo_tag}, context PlatformAlarmService 10-03 11:14:24.773 5502-20672/ I/JobExecutor: Finished job{id=15, finished=true, result=SUCCESS, canceled=false, periodic=false, class=GeofenceLimboJob, tag=job_geofence_limbo_tag} 10-03 11:14:24.776 5502-20670/ D/PlatformAlarmService: Finished job, request{id=15, tag=job_geofence_limbo_tag} SUCCESS

Right after the job is scheduled i’m putting the device in IDLE state through the adb. As you can see, there is an delay almost twice the time i’ve set the alarm. Is this the expected behaviour? From what I’ve understood, since this uses AlarmManager it should wake the device after the 2min.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
miguelaboliveiracommented, Oct 3, 2017

So, I had a deeper look at this and it seems that it is indeed an limitation of the setExactAndAllowWhileIdle method, which is what seems to be user by your library for exact jobs with SDK > 23.

To reduce abuse, there are restrictions on how frequently these alarms will go off for a particular application. Under normal system operation, it will not dispatch these alarms more than about every minute (at which point every such pending alarm is dispatched); when in low-power idle modes this duration may be significantly longer, such as 15 minutes.

So, when I reduced the frequency that I was scheduling this job the delay disappeared.

Thank you for the information regarding the AlarmManager restrictions.

0reactions
vRallevcommented, Oct 3, 2017

Awesome, thanks for sharing your findings.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Optimize for Doze and App Standby | Android Developers
Doze reduces battery consumption by deferring background CPU and network activity for apps when the device is unused for long periods of time. ......
Read more >
Android Marshmallow 6.0: Introduction to Doze Mode - YouTube
Android Marshmallow introduced Doze mode - -a new way for the device to preserve battery by entering into an idle state.
Read more >
setAlarmClock() fires too late in doze mode - Stack Overflow
Try using: setExactAndAllowWhileIdle(). This will ensure that the alarm fires on time. I have tested it in my own app and it's reliable....
Read more >
*QUALM; *QuOion Answering Systems 1 - ERIC
answering questions dbour stoileS, the theoretical goes beyond this particular context. As a theoretical mode. QUALM describes, general question a.
Read more >
large power consumption: Topics by Science.gov
While measurement is a known and precise strategy for power consumption evaluation ... WSNs energy consumption using different power modes in a sensor...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found