问题
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