AlarmManager,当手机是睡着了报警不叫 [英] AlarmManager, alarm is not called when the phone is asleep

查看:152
本文介绍了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,当手机是睡着了报警不叫的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆