• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

setExactAndAllowWhileIdle not reliable

mhogan

Lurker
Has anyone successfully gotten setExactAndAllowWhileIdle (Alarm Manager) to work reliably? I'm making an alarm clock app and it's pretty important to have the alarm fire at the desired time. I'm using the Alarm Manager to call a Service which I then call startForeground() immediately in the on Create() method and request a wakeLock(). I'm using it to chime on the hour and half hour. I invariably miss two or three alarms a day. Sometimes I won't get an alert for a couple hours and then magically it will start working again.

I think this might be related to battery conservation but everything I've read says that setExactAndAllowWhileIdle will ALWAYS trigger at the desired time (plus or minus a few milliseconds).

I'm happy to provide more info but I'm not looking for anyone to write my code for me. I just want a friendly nudge in the right direction.

I should mention that this seems to work properly in the emulator but not on real-world devices. I've tested it with a Samsung Galaxy Tab S6 and a Google Pixel C Tablet and both exhibit the problem I've described.
 
Back
Top Bottom