Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GCM: how to avoid throttling

My android system needs to send frequent updates to an app for tablet (a kiosk always connected to wifi and power plug).
GCM-HTTP (//developer.android.com/google/gcm/http.html) works fine but in some cases it can happen that a single device receives many notifications triggering the well- known throttling issue described here (//developer.android.com/google/gcm/adv.html#throttling). This is a problem since the payload in the notification is of great importance for the system. What is the best solution to prevent this?

  • implement in the server a service that groups notifications to the same device and shoot them with a limited frequency.
  • use a XMPP service. I would like to use GCM-XMPP (//developer.android.com/google/gcm/ccs.html) but you need to be signed in a whitelist so I don't think everyone can already use it. As alternatives should I use aSmack or Quickblox as advised here (Android and XMPP: Currently available solutions) and here (Better Way to implement the chat application using XMPP on Android?) respectively?
  • implement a basic socket connection as described in (//thinkandroid.wordpress.com/2010/03/27/incorporating-socket-programming-into-your-applications/)? In this case I have to take into consideration the possibility of the connection getting momentarily lost?

SOLUTION: I found the solution to my question, that is XMPP protocol. At the beginning I implemented aSmack in the tablet application and configured an eJabberd server running locally. The implementation has been pretty easy. After a couple of weeks I received a mail from Google for the GCM-XMPP, that is even quicker to embed in the app and works super fine!

like image 550
deleElon79 Avatar asked Oct 20 '22 19:10

deleElon79


1 Answers

Maybe setting time_to_live to 0.

From 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."

like image 182
hahahut Avatar answered Oct 24 '22 05:10

hahahut