My application sending push notifications from the server to several user devices. Notification will valid for a certain time period in my app scenario. currently, all notifications go through my app, but I don't send this at all after given expiration time. Code to send on a user.
{
"to":"REGISTRATION_ID", // "to" replaces "registration_ids"
"notification": {
"title": "Portugal vs. Denmark”,
"body”: "5 to 1”
},
"time_to_live":"600"
}
Note: "time_to_live" attribute not works.
Your push notifications certificates are generally only valid for one year.
The value must be a duration from 0 to 2,419,200 seconds (28 days), and it corresponds to the maximum period of time for which FCM stores and attempts to deliver the message.
Firebase Cloud Messaging (FCM) provides a reliable and battery-efficient connection between your server and devices that allows you to deliver and receive messages and notifications on iOS, Android, and the web at no cost.
If specified and a notification with the same tag is already being shown, the new notification replaces the existing one in the notification drawer.
You should use the following as per this documentation: Setting the lifespan of a message.
"android": {
"ttl":"600s"
}
instead of
"time_to_live":"600"
You should set it as numeric:
"time_to_live": 600
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With