How to send GCM messages to multiple devices at a time

Solution 1:

What you should do is send multiple registrations Ids (up to 1000 at once) when you send your message to GCM, and you will need to use JSON as your request format.

You can read more about that here: https://developers.google.com/cloud-messaging/server-ref#downstream

You will need to add your list of Id's to the registration_ids field:

A string array with the list of devices (registration IDs) receiving the message. It must contain at least 1 and at most 1000 registration IDs. To send a multicast message, you must use JSON. For sending a single message to a single device, you could use a JSON object with just 1 registration id, or plain text (see below). Required.

Here is an example request from their docs:

Here is a message with a payload and 6 recipients:

{ "data": {
   "score": "5x1",
   "time": "15:10"
  },
  "registration_ids": ["4", "8", "15", "16", "23", "42"]
}