使用setRepeating()方法知道下一个警报时间

编程入门 行业动态 更新时间:2024-10-21 17:47:00
本文介绍了使用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()方法知道下一个警报时间

本文发布于:2023-11-27 03:49:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1636457.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:警报   时间   方法   setRepeating

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!