从API 19开始,setRepeating()的工作方式与setInexactRepeating()的工作方式相同.
什么是设置精确重复警报的新方法?
什么是设置精确重复警报的新方法?
即什么是旧的setRepeating()的API 19版本?你能否提供一个在KitKat每天早上7:30(每天重复)设置闹钟的例子?
解决方法
不幸的是,它不存在.从
documentation:
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.
简而言之,如果您需要精确重复的alams,可以使用setExact()创建一个警报,但是您需要手动处理“重复”部分.