AlarmManager - 预计报警的行为,当设备时间改变了吗? [英] AlarmManager - expected behaviour of alarm when device time is changed?

查看:231
本文介绍了AlarmManager - 预计报警的行为,当设备时间改变了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我今天使用 AlarmManager.set(int型的,长triggerAtMillis,操作的PendingIntent)方法14:00设置闹钟和当前的时间是下午1点。现在,如果我更改时间在设备上是下午3时(即今天下午3点或将来的任何一天),会发生什么我报警?它应该触发?

Assume I set an alarm using the AlarmManager.set(int type, long triggerAtMillis, PendingIntent operation) method for 2pm today and the current time is 1pm. Now, if I change the time on the device to be 3pm (i.e. 3pm today or any day in the future), what should happen to my alarm? Should it trigger?

推荐答案

这不会被 AlarmManager 不会触发。所以,你应该听关于时间变化的行动,并重新创建报警。

No that will not triggered by AlarmManager. So you should listen about time change actions and re-create the alarm.

这些行动

Intent.ACTION_TIME_TICK
Intent.ACTION_TIMEZONE_CHANGED
Intent.ACTION_TIME_CHANGED

不报警管理器甚至重新启动后仍然存在?是一个更好的答案理解您的问题并解决。

does Alarm Manager persist even after reboot? is a better answer to understand your problem and resolve that.

这篇关于AlarmManager - 预计报警的行为,当设备时间改变了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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