简体   繁体   English

如何跟踪我的重复警报何时响起并更新设置值?

[英]How can I keep track of when my repeating alarms goes off and update the set value?

The way the alarm manager currently works, I have to use: 警报管理器当前的工作方式,我必须使用:

//Set Alarm to Repeat
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, timeInMilis, interval, pendingIntent);

to schedule a repeating alarm. 安排重复警报。

Currently, I'm pulling a time string from the database, converting it to miliseconds and setting this repeating alarm based on an interval in the database. 目前,我正在从数据库中提取一个时间字符串,将其转换为毫秒,并根据数据库中的时间间隔设置此重复警报。

I am now wondering, what can I do so that when the alarm goes off, I can update the same time data in the database to a new future alarm date? 我现在想知道,该怎么办,以便在警报响起时,可以将数据库中的相同时间数据更新为新的未来警报日期?

That way, I can pull when the next alarm time is from the database and display it on the screen. 这样,我可以从数据库中提取下一个警报时间,并将其显示在屏幕上。

您可以使用以下方式实现此目的:-在Alarm熄灭时设置自定义广播接收器,在onReceive()旁边将您想要的内容保存到首选项或sqlite中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM