开发者

AlarmManager, alarm is not called when the phone is asleep

开发者 https://www.devze.com 2023-03-07 01:42 出处:网络
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); long schedualed = getNextSchedualTime(context);
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
long schedualed = getNextSchedualTime(context);
alarmManager.set(AlarmManager.RTC, schedualed, 开发者_JS百科makeControlPendingIntent(context));

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?


From official documentation 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.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消