Does anyone have a link to GCM java 3rd Party Server example? I can't understand how to implement it. In http://developer.android.com/google/gcm/server.html, I could not find a complete example.
Google Cloud Messaging (GCM) is a service that allows you to send push notifications from your server to your users' Android devices, and also to receive messages from devices on the same connection.
Google Cloud Messaging (GCM) is a service that lets developers send data from servers to users' devices, and receive messages from devices on the same connection.
The easiest way is to use gcm-server.jar
(which you can get from here).
Then the code you'll need to send a GCM message will look like this :
Sender sender = new Sender(apiKey);
Message message = new Message.Builder()
.addData("message", "this is the message")
.addData("other-parameter", "some value")
.build();
Result result = sender.send(message, registrationId, numOfRetries);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With