I would like to create a notification in Android that has an expiration date, meaning that on a certain date, if it's not open, it will be automatically destroyed or removed. Is this possible? Does someone knows how to do this?
Thanks for your help.
You can remove your own app's notifications if you have the notification ID by calling
NotificationManager.cancel
. To implement the expiration, you can set an alarm withAlarmManager
to wake up aBroadcastReceiver
that will simply cancel the notification. (If the notification is no longer there, then the call to cancel will do nothing.)In your BroadcastRecevier...