How to use Google Cloud Connection Server to send an upstream GCM message

I am trying to send an upstream message from my device to the cloud using the new Cloud Connection Server feature from Google Cloud Messaging. I use the sample code in the Getting Started guide.
http://developer.android.com/google/gcm/gs.html

I can configure the client side and get the registration ID. But when I send a message to the server, nothing happens. I'm not sure that I need to make some settings on the server. My main requirement for the server is to receive a message from the client and send a response back. I am using a Java based server server. I could not find anything specific in the server side configuration documentation.

Can anybody help?

+4
source share
3 answers

Yes, it is certainly possible
http://developer.android.com/google/gcm/ccs.html

The GCM Cloud Connection Server (CCS) allows third party servers to communicate with Android devices by establishing a persistent TCP connection with Google servers using the XMPP protocol. This communication is asynchronous and bidirectional. 
+1
source

You cannot simply register with GCM on the client side and send messages to your server. This only takes care of the connection between your device and the GCM server.

You need to configure your server to connect to the GCM Cloud Connection Server (CCS) in order to be able to send and receive messages on your server:

GCM Cloud Connection Server (CCS) is an XMPP endpoint running on http://gcm.googleapis.com port 5235.

CCS requires a Transport Layer Security (TLS) connection. This means the XMPP client must initiate a TLS connection. For example, in smack, you would call setSocketFactory (SSLSocketFactory), similar to the "old SSL style" of XMPP connections and https.

CCS requires a SASL PLAIN authentication mechanism, using @ gcm.googleapis.com (GCM sender ID) and the API as a password, where the sender ID and API key are the same as those described in the Getting Started section.

You can use most XMPP libraries to interact with CCS.

+1
source

GCS is currently in beta testing and requires you to apply. Quoting the documentation page :

Note. To try this feature, register using this form .

Are you registered? After that, Google should come back to you and provide you access to the service.

+1
source

Source: https://habr.com/ru/post/1484593/


All Articles