2

I have about 1500 registration ID, i tried to send 1 push notification. But it didn't. Is it GCM does not allow sending to more than 1000 registration ID per message ?

Azizi Musa
  • 1,009
  • 2
  • 10
  • 31

2 Answers2

2

That's correct. A single request to GCM can contain up to 1000 Registration IDs. You'll have to split your 1500 IDs into two separate requests.

Eran
  • 387,369
  • 54
  • 702
  • 768
  • 1
    thx, just found the exact paragraph on android website https://developer.android.com/google/gcm/server.html#send-msg`Target Required. When your app server sends a message in GCM, it must specify a target. For HTTP you must specify the target as one of: registration_ids: For sending to 1 or more devices (up to 1000). When you send a message to multiple registration IDs, that is called a multicast message. notification_key: For sending to multiple devices owned by a single user.` – Azizi Musa Oct 13 '14 at 01:33
  • @Eran I am using App Engine Endpoint with GCM. In my code in MessagingEndpoint class I got below lines List records = ofy().load().type(RegistrationRecord.class).limit(10).list(); for (RegistrationRecord record : records) { //Original Code line Result result = sender.send(msg, record.getRegId(), 5); ...} So can you please tell me how to split your 1500 IDs into two separate requests. Thanks – Programmer Apr 15 '15 at 05:56
2

Quoting from Google Docs:

GCM is support for up to 1,000 recipients for a single message. This capability makes it much easier to send out important messages to your entire user base. For instance, let's say you had a message that needed to be sent to 1,000,000 of your users, and your server could handle sending out about 500 messages per second. If you send each message with only a single recipient, it would take 1,000,000/500 = 2,000 seconds, or around half an hour. However, attaching 1,000 recipients to each message, the total time required to send a message out to 1,000,000 recipients becomes (1,000,000/1,000) / 500 = 2 seconds. This is not only useful, but important for timely data, such as natural disaster alerts or sports scores, where a 30 minute interval might render the information useless.

Taking advantage of this functionality is easy. If you're using the GCM helper library for Java, simply provide a List collection of registration IDs to the send or sendNoRetry method, instead of a single registration ID.

AniV
  • 3,997
  • 1
  • 12
  • 17