Reputation: 23
Is it possible to expire a push notification after delivered to a device. I know that you can expire a notification with the time_to_live
or expiration_interval
set inside the JSON, which is send to APN or GMS.
But is it possible to hide/clear a push notification after, say 10 min?
Upvotes: 1
Views: 1091
Reputation: 6791
@Felix, it is not possible to hide/clear a push notification after being sent. You just can replace a notification that is not yet delivered by setting it to a Collapsible Message:
A collapsible message is a message that may be replaced by a new message containing the same collapse key if it has yet to be delivered to the device.
Here is a sample json format message:
{
"collapse_key" : "demo",
"delay_while_idle" : true,
"to" : "xyz",
"data" : {
"key1" : "value1",
"key2" : "value2",
},
"time_to_live" : 3
}
If another message will be queued with the same collapse key, the newer message will be sent and the older message will be disregarded. I hope it clear some question regarding setting up an expiration to the notification.
Upvotes: 1