Up Vert
Up Vert

Reputation: 35

GCM Sends message to an Idle device even with time_to_live is 0

I have the following parameters set on the message:

time_to_live = 0;
delay_while_idle = false;

Now I send the message to 2 devices : device_1 is kept in idle mode (locked screen) device_2 is active.

I receive the message on device_2 right away (Good, As Expected)
After a while (~ 5 seconds) I unlock the screen of Device_1 and make it active, and to my surprise I also get the message on device_1 (Strange, UnExpected)

Why is such a behavior, or did I misunderstood the fact below in GCM documentation?

**

Fact from the GCM documentation

** (http://developer.android.com/google/gcm/adv.html) 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.

Upvotes: 0

Views: 718

Answers (1)

Eran
Eran

Reputation: 393851

If you send your message with delay_while_idle = false, this means it would be delivered to an idle device immediately. You should send it with delay_while_idle = true.

Upvotes: 2

Related Questions