使用setRepeating()方法知道下一个警报时间 [英] to know next alarm time using setRepeating() method

查看:61
本文介绍了使用setRepeating()方法知道下一个警报时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有9:00 AM,1:00 PM,7:00 PM之类的时间,我每天设置3个待处理的意图,这些意图是使用setRepeating()方法递归触发的。

I have times like 9:00 AM, 1:00 PM, 7:00 PM, where I set 3 pending intents that are recursively triggered using setRepeating() method every day.

(这里我将所有这些待处理的意图唯一请求代码保存在本地SQLite数据库中)

(Here I am saving all these pending intents unique request codes in the local SQLite database)

这里,每当触发警报时,我都想知道下一个将要触发并显示给用户的警报

Here, whenever an alarm is triggered I would like to know the next alarm that is going to be triggered and show to user

示例。现在,警报在上午9:00触发,此时我应该向用户显示下一个警报将在1:00 PM触发。
有什么解决方法可以使我获得下一个警报详细信息。

Example.. Now an alarm was triggered at 9:00 AM and at this time I should display the user that the next alarm is going to be triggered at 1:00 PM. Is there any solution that I could get the next alarm details.

希望我能正确传达。如有疑问,请告诉我

Hope I conveyed correctly.If any queries please let me know

谢谢!

推荐答案

正如我在另一个问题中所说,您无法获得来自AlarmManager的信息。您需要将信息自己存储在SharedPreferences中,以便以后使用。

As I said in the other question, you cannot get this information from the AlarmManager. You would need to store the information yourself in a SharedPreferences so that you can refer to it later.

例如,每当闹钟响起时,您都可以将SharedPreferences更新为指示下一次重复的时间。

For example, whenever your alarm goes off, you can update the SharedPreferences to indicate when the next repeat should happen.

这篇关于使用setRepeating()方法知道下一个警报时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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