androidalarmmanager

Just how inexact is setInexactRepeating() for AlarmManager?


I know this question has been asked before, here, but the answer given refers to documentation which is actually incredibly ambiguous. It says the inexact alarm might occur almost a "full interval" after the specified time. For alarms with an interval of a whole day, this would seem excessive.

The documentation does say here (under "RTC examples") that you can use inexact repeating for daily alarms, and gives an example of an inexact alarm being set for "approximately 2pm". Nobody in their right mind would think "approximately 2pm" might mean 1pm the next day, so it doesn't seem likely daily alarms at least can be "almost a full interval" after the specified time.

Is there any definite info out there about just how late an inexact alarm with a daily interval might be? Thanks.

(I know API 19 has "setWindow" but I'd like my app to work on older APIs too).


Solution

  • I've tested this with 5 consecutive alarms and the average delay, on my phone, was 11.8 minutes. This was with the interval between repeats set to INTERVAL_DAY.