从 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.
简而言之,如果您需要精确的重复警报,您可以使用 setExact()
创建警报,但您需要手动处理“重复”部分。
关于android - 如何在 API 19 (kitkat) 上设置精确的重复警报?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24298595/