My app requires very accurate timing of a repeating alarm. Since API 19 the AlarmManager setRepeating is now inexact to save battery ( Save the trees and all ).
Is there any workaround to get API 19's setExact method to work on a loop?
Note: as of API 19, all repeating alarms are inexact. If your application needs precise delivery times then it must use one-time exact alarms, rescheduling each time as described above. Legacy applications whose targetSdkVersion is earlier than API 19 will continue to have all of their alarms, including repeating alarms, treated as exact.
Sure. Have your
BroadcastReceiver
, or whatever is getting control from the alarm, callsetExact()
to schedule the next recurrence, in addition to doing its existing work.Bear in mind, though, that the changes to background processing in Android M may cause you difficulty.