Reputation: 524
I am trying to implement GCM push notifications for my Android application. I have implemented GCM Client in my Android app by referring this link. In GCM client it has a method:
/**
* Sends the registration ID to your server over HTTP, so it can use GCM/HTTP or CCS to send
* messages to your app. Not needed for this demo since the device sends upstream messages
* to a server that echoes back the message using the 'from' address in the message.
*/
private void sendRegistrationIdToBackend()
{
// Your implementation here.
}
I was trying to find out the ways in which the registration ids can be stored at the backend. While searching I got to know that Google App Engine can be used to deploy the server side code by referring to this link As per my knowledge for every android application to implement push notifications to client, they would require list of all the registration ids. Following are few of my questions
Upvotes: 1
Views: 2054
Reputation: 393821
The only way to get all the registration IDs of the devices that installed your app is to maintain a DB of those devices in your server. Or you can use a 3rd party provider (such as UrbanAirship) to do it for you.
The GCM server has all those IDs, but there's no API call that returns all registered registration IDs for a given app.
Each application that uses GCM requires a server side that would maintain a list of registered devices, and send messages to the devices. You can use a 3rd party push provider to do that for you.
If you want to send the updates to all registered devices, you have to specify all the registration IDs for which you want to send the message. If all devices get the same message, you can send the message to a 1000 registration IDs in one HTTP request (and if you have more than a 1000 devices, you'll have to do multiple requests).
Upvotes: 4