Create an Android notification with expiration date

后端 未结 2 1459
粉色の甜心
粉色の甜心 2020-12-18 06:19

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 remove

2条回答
  •  爱一瞬间的悲伤
    2020-12-18 06:25

    https://developer.android.com/reference/android/app/Notification.Builder.html#setTimeoutAfter(long)

    you can specify a duration in milliseconds after which this notification should be canceled, if it is not already canceled.

    from: https://stackoverflow.com/a/56072643/969016

提交回复
热议问题