Skip to content Skip to sidebar Skip to footer

Does Fcm Has A Disadvantage That, If A Device Is Offline, And Message Is Triggered From Fcm, The Message Is Not Received On Device On Coming Online?

Long time ago, I used GCM in my Android app. It had a disadvantage. When a message was triggered from GCM to my Android app, if the device was not connected to internet, the messag

Solution 1:

If the device is not connected to FCM, the message is stored until a connection is established (again respecting the collapse key rules). When a connection is established, FCM delivers all pending messages to the device. If the device never gets connected again (for instance, if it was factory reset), the message eventually times out and is discarded from FCM storage. The default timeout is four weeks, unless the time_to_live flag is set.

https://firebase.google.com/docs/cloud-messaging/concept-options

Solution 2:

Have your set 0 value of time_to_live parameter?

Keep in mind that a time_to_live value of 0 means messages that can't be delivered immediately are discarded.

On Android and Web/JavaScript, you can specify the maximum lifespan of a message. 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. Requests that don't contain this field default to the maximum period of four weeks.

Post a Comment for "Does Fcm Has A Disadvantage That, If A Device Is Offline, And Message Is Triggered From Fcm, The Message Is Not Received On Device On Coming Online?"