Reputation: 28473
Google Cloud Messaging appears to only provide sample code in Java. I run ruby on my servers and wish to use google-api-ruby-client to power my GCM installation instead. Are there any guides on how to do this? I just want "hello world" for GCM using google-api-ruby-client.
Upvotes: 0
Views: 607
Reputation: 28473
Nevermind - This doesn't require use of google-api-ruby-client with its more advanced authentication logic, and instead uses the much simpler API Key that can be used with simple POST requests. From the docs:
Server changes
When the application server receives a GCM registration ID, it should store it and mark it as such.
Sending messages to GCM devices requires a few changes:
The request should be sent to a new endpoint: https://android.googleapis.com/gcm/send. The Authorization header of the request should contain the API key generated during sign up. This key replaces the deprecated ClientLogin Auth token. For example:
Content-Type:application/json
Authorization:key=AIzaSyB-1uEai2WiUapxCs2Q0GZYzPu7Udno5aA
{ "registration_id" : "APA91bHun4MxP5egoKMwt2KZFBaFUH-1RYqx...",
"data" : {
"Team" : "Portugal",
"Score" : "3",
"Player" : "Varela", },
}
For a detailed discussion of this topic and more examples, see the Architectural Overview.
Upvotes: 1