I was developing android application which uses GCM, but I want to cancel message delivery if user phone is not online. Is there any way to decrease time to live value to minimum?
I found an answer @ http://developer.android.com/google/gcm/adv.html
Another advantage of specifying the expiration date for a message is that GCM will never throttle messages with a time_to_live value of 0 seconds. In other words, GCM will guarantee best effort for messages that must be delivered "now or never." Keep in mind that a time_to_live value of 0 means messages that can't be delivered immediately will be discarded. However, because such messages are never stored, this provides the best latency for sending notifications.
Here is an example of a JSON-formatted request that includes TTL:
{
"collapse_key" : "demo",
"delay_while_idle" : true,
"registration_ids" : ["xyz"],
"data" : {
"key1" : "value1",
"key2" : "value2",
},
"time_to_live" : 3
},
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