How to set an exact repeating alarm on API 19 (kitkat)?

前端 未结 1 706
半阙折子戏
半阙折子戏 2020-12-19 03:20

Starting from API 19, setRepeating() works the same way as setInexactRepeating(). What\'s the new way of setting an exact repeating alarm?

相关标签:
1条回答
  • 2020-12-19 04:00

    It doesn't exist, unfortunately. From the 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.

    In short, if you need exact repeating alams, you can create an alarm with setExact(), but you'll need to handle the "repeating" part manually.

    0 讨论(0)
提交回复
热议问题