如果我添加警报但将开始日期设置为过去日期会发生什么?
是立即执行还是放入队列并且从未执行过?
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,startDate,repeatingValue,alarmIntent);
解决方法
如果日期是过去那么警报将立即触发.但是,您可以尝试使用setInexactRepeating而不是setRepeating:
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,setInexactRepeating,alarmIntent);
Schedule a repeating alarm that has inexact trigger time requirements; for example,an alarm that repeats every hour,but not necessarily at the top of every hour.