AlarmManager,当手机是睡着了报警不叫

编程入门 行业动态 更新时间:2024-10-18 20:31:41
本文介绍了AlarmManager,当手机是睡着了报警不叫的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); long schedualed = getNextSchedualTime(context); alarmManager.set(AlarmManager.RTC, schedualed, makeControlPendingIntent(context));

我知道设置 RTC_WAKEUP 将运行,即使手机处于睡眠。但我想知道什么时候手机是睡着了,就应在睡眠时间触发的 RTC 报警延迟到时候手机唤醒?

I know to set RTC_WAKEUP would run even if phone is sleep. But I want to know when the phone is asleep, would the RTC alarm which should be triggered in the sleeping time be delayed to when the phone wake up?

推荐答案

从官方文档的这里:

报警时间   System.currentTimeMillis的()(挂钟  UTC时间)。该报警没有醒来  该设备了;如果它熄灭,而  该装置是睡着了,它不会  输送的直到下一次  设备醒来。

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.

所以回答你的问题:是的,这将被推迟,并不会被删除。

So answer to your question: yes, it will be delayed and will not be dropped.

更多推荐

AlarmManager,当手机是睡着了报警不叫

本文发布于:2023-11-27 07:36:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1637143.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:睡着了   不叫   手机   AlarmManager

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!