【发布时间】:2016-08-19 18:31:23
【问题描述】:
我设置了多个闹钟,为了控制它们,我更改了手机的时间。他们会正常工作吗?换句话说,如果我更改手机的时间,闹钟会崩溃吗?
【问题讨论】:
标签: android android-intent alarmmanager android-pendingintent android-alarms
我设置了多个闹钟,为了控制它们,我更改了手机的时间。他们会正常工作吗?换句话说,如果我更改手机的时间,闹钟会崩溃吗?
【问题讨论】:
标签: android android-intent alarmmanager android-pendingintent android-alarms
这一切都取决于您在警报管理器的 set 方法中传递的类型。
如果您已使用 ELAPSED_REALTIME 或 ELAPSED_REALTIME_WAKEUP,则不会触发警报
ELAPSED_REALTIME
Added in API level 1
int ELAPSED_REALTIME
Alarm time in SystemClock.elapsedRealtime() (time since boot, including sleep). This alarm does not wake the device up; if it goes off while the device is asleep, it will not be delivered until the next time the device wakes up.
如果您有用户RTC或RTC_WAKEUP,将根据设备时间触发警报
RTC
Added in API level 1
int RTC
Alarm time in System.currentTimeMillis() (wall clock time in UTC). This alarm does not wake the device up; if it goes off while the device is asleep, it will not be delivered until the next time the device wakes up.
【讨论】:
我不知道你所说的崩溃是什么意思。但是警报只知道设备的时间,因此如果您确实更改了设备时间,它应该会与之相反。
【讨论】: