to know next alarm time using setRepeating() method

拈花ヽ惹草 提交于 2019-12-02 05:13:59

问题


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.

(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

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

Thanks in Advance!


回答1:


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.

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



来源:https://stackoverflow.com/questions/47863394/to-know-next-alarm-time-using-setrepeating-method

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!