Skip to content Skip to sidebar Skip to footer

Do I Need To Persist My Notification Ids

I have an alarm application where users can set multiple alarms. When an alarm goes off the app simply displays a Notification which when clicked will launch the main activity scre

Solution 1:

To do this I need to track the IDs of the Notifications currently showing.

Or just call cancelAll() on NotificationManager, to cancel all your outstanding notifications.

What is the recommended way of doing this?

To be safe, you should use some persistent data store (e.g., file), as your process might go poof between alarms.

I suppose these will need to be persisted as my app's process could be killed as soon as a Notification has been created and displayed. Is my thinking correct?

It could certainly be killed before the next alarm, as discussed in your other recent question.

Post a Comment for "Do I Need To Persist My Notification Ids"