Just how inexact is setInexactRepeating() for AlarmManager?

旧街凉风 提交于 2019-12-22 04:36:08

问题


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).


回答1:


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.



来源:https://stackoverflow.com/questions/22303700/just-how-inexact-is-setinexactrepeating-for-alarmmanager

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!