gpt4 book ai didi

android - AlarmManager,手机休眠时不调用闹钟

转载 作者:行者123 更新时间:2023-11-29 18:19:55 25 4
gpt4 key购买 nike

AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
long schedualed = getNextSchedualTime(context);
alarmManager.set(AlarmManager.RTC, schedualed, makeControlPendingIntent(context));

我知道设置 RTC_WAKEUP 即使手机处于 sleep 状态也会运行。但是我想知道当手机处于 sleep 状态时,应该在 sleep 时间触发的RTC闹钟会不会延迟到手机唤醒时?

最佳答案

来自官方文档here :

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.

所以回答你的问题:是的,会延迟,不会掉线。

关于android - AlarmManager,手机休眠时不调用闹钟,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6071425/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com