3

I'm using Google Cloud Messaging and have been working on both the application server side (the server that sends push messages) and the Android side (the smartphone app that receives push messages).

Google used to maintain documentation with some Java code for the application server at this link: http://developer.android.com/google/gcm/server.html

However, that link is now dead. It points to https://developers.google.com/cloud-messaging/ now and does not have any information on implementing the application server, in particular in Java.

Where is the application server documentation now, and where can I find the sample code for it?

Of most importance, I need to know what firewall ports to open on the application server side to connect to Google's servers. There are related StackOverflow messages on GCM ports, but again, they all point to URLs that are now dead.

UPDATE 6/12:

I found cached copies of that webpage using the Wayback Machine: http://web.archive.org/web/*/http://developer.android.com/google/gcm/server.html

Community
  • 1
  • 1
stackoverflowuser2010
  • 38,621
  • 48
  • 169
  • 217
  • Seems like the old Java server application code was removed from the gcm repository a few weeks ago in this commit: https://github.com/google/gcm/commit/391d61f047e509f130473714864c4293e1b5ee22 . It was referred to as legacy, but I can't find any replacement library. – Geir Engdahl Jun 13 '15 at 20:17

1 Answers1

0

The new server documentation is here: https://developers.google.com/cloud-messaging/http

The old Java server code has been removed, but there is similar and more up to date code in the GCM demo app that is in the git repo now, for example: https://github.com/google/gcm/blob/master/gcm-demo-app/src/main/java/com/google/android/gcm/demo/logic/GcmServerSideSender.java

You should be able to base you server code of this, or extract it into your server.

morepork
  • 973
  • 6
  • 9
  • I am looking for documentation, firewall configuration, and Java code for the Application Server (the server that initiates the push notification), not the Connection Server (the server that relays the notification to the clients). The document in your first URL is for Google's Connection Server, as is obviously stated in the first paragraph: `This document describes the Google Cloud Messaging (GCM) HTTP connection server. Connection servers are the Google-provided servers that take messages from the application server and sending them to the device.` – stackoverflowuser2010 Jun 15 '15 at 17:44
  • If you look past the first paragraph, which I agree is misleading, you will see it documents the format of the requests that your application server needs to make to push a message to a device. There is a box on the same page with firewall config around here: https://developers.google.com/cloud-messaging/http#message-with-payload--data-message And the second link contains example code for pushing messages used by the demo app that should work in your server. – morepork Jun 18 '15 at 16:54