5

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!

Community
  • 1
  • 1
deleElon79
  • 51
  • 1
  • 3
  • Please don't edit your solution in the question. Instead answer your own question and mark the question answered. – Flow Jan 05 '15 at 16:17

1 Answers1

3

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

hahahut
  • 94
  • 7
  • Thanks a lot for your time. Unfortunately setting time_to_live to 0 does not prevent the throttling issue. All the documentation on developer.android has been already deeply studied. – deleElon79 Feb 24 '14 at 11:49
  • So did you find a way around it? I am deploying an app that needs to push notification probably to 100+ devices every minute for an hour. I am very nervous about the throttling issue, but don't have that many devices to test beforehand. – hahahut Feb 24 '14 at 19:40
  • @deleElon79, can you explain about throttling and ttl and setting it to 0 will not solve this – guy_fawkes Feb 25 '14 at 18:40
  • @hahahut: The throttling issue is really linked to how many messages per minute a device receives. So it is not important (for what throttling matters) to how many devices you send messages. What matters is the frequency, so in theory you could test just with one or two devices. You talk about 1msg/min, to me it seems not a high frequency, but the maximum frequency is not specified by google so you do have to run some test for a meaningful length of time. If you are not satisfied you should switch to XMPP protocol that is more "reliable", especially if your msgs are time critical. – deleElon79 Feb 26 '14 at 12:32
  • @abbiya: you can find this information in the android documentation. As I said in previous comment throttling is linked to how many msg/min a device receives. If you send two many msg to one device, even if the TTL is 0 throttling will be triggered. – deleElon79 Feb 26 '14 at 12:35
  • 1
    @deleElon79 they also say that gcm can be directly used in apps like instant messaging apps. If they throttle in apps like im, how it's going to work. Let's say with ttl 0, server is sending lots of messages per minute. If they can't be delivered right now, then they are discarded. There is no throttling. But the documentation does not specify how they are stoping misusing service. – guy_fawkes Feb 26 '14 at 17:59