Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GCM msg delivery times are WILDLY erratic

I've setup an Android app with GCM support, and have a little test app to send a msg to the app. When I run the App in the emulator, I can see (via logging msgs) that it registers with GCM and gets a Token.

Then when I put the token in my test app and have it send a msg, the result shows that 1 msg was sent, 0 failed, and 0 had ID changes.

Sometimes the msg shows up almost immediately, sometimes it takes 20 minutes. On Friday, my 2 test msgs took 15 and 20 minutes. The first 2 I sent this morning were immediately, the next one hasn't shown up yet - it's only been 10 minutes...

Is there anything I can do to make the delivery times consistently fast? A random 20 minute delay will be pretty much an unacceptable condition.

like image 648
CasaDelGato Avatar asked Oct 22 '12 17:10

CasaDelGato


2 Answers

We had the same problem, but it varied from network-to-network. We think it was the home hub router (a Virgin Super Hub) dropping the connection after five minutes of inactivity. You can confirm by sending an empty GCM message every two minutes to keep the connection alive.

Here is a more in-depth explanation of what we did: https://groups.google.com/d/msg/android-gcm/Y33c9ib54jY/YxnCkaPRHRQJ

like image 118
Rupert Rawnsley Avatar answered Oct 13 '22 21:10

Rupert Rawnsley


You cannot guarantee fast delivery because GCM to device connectivity may be poor as CommonsWare has pointed out. There are however, two possible delays in the delivery train: 1) GCM connecting to the phone (as mentioned previously) and 2) The delay in the message actually being sent out from the GCM server. If you set the 'time_to_live' parameter to 0 seconds in your sending application, then you can at least test where the delay is occurring.

A value of 0 seconds means that the message will be sent immediately and if delivery is unsuccessful, the message will be discarded on the GCM server. It is not a practical value for real life use, but will enable you to find out which part of the delivery train is causing the delay.

like image 4
NickT Avatar answered Oct 13 '22 20:10

NickT