发送到设备后过期推送通知

Expire push notification after delivered to device

是否可以在发送到设备后使推送通知过期。我知道您可以在 JSON 内设置 time_to_liveexpiration_interval 使通知过期,该通知会发送到 APN 或 GMS。

但是有没有可能 hide/clear 推送通知,比如说 10 分钟?

@Felix,发送后无法hide/clear推送通知。您只需将尚未发送的通知设置为 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.

这里是 json 格式消息的示例:

{
"collapse_key" : "demo",
"delay_while_idle" : true,
"to" : "xyz",
"data" : {
"key1" : "value1",
"key2" : "value2",
},
"time_to_live" : 3
}

如果另一条消息将使用相同的折叠键排队,则将发送较新的消息而忽略较旧的消息。我希望它能解决一些关于设置通知到期的问题。