简体   繁体   中英

Is there a Java API for GCM Cloud Connection Server

I am just going through the new features of GCM Cloud connection server. On client side this seems fairly easy using the google play services, as described in https://developer.android.com/google/gcm/ccs.html , however for the server side it says:

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. That means the XMPP client must initiate a TLS connection. For example in smack, you would call setSocketFactory(SSLSocketFactory), similar to “old style SSL” XMPP connections and https.

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

Does that mean I manually have to open a port and parse xml/json or is there some kind of Java API that I can use to implement the server side?

For the GCM Server there is a library, the javadoc is at http://developer.android.com/reference/com/google/android/gcm/server/package-summary.html

There is a demo server app Google has written here at http://developer.android.com/google/gcm/server.html

As I understand you can choose whether you want to use the XMPP service or the old HTTP service. Not sure what the advantage is.

You can use Smack library to work with XMPP in Java. And here you can find an example code that sends notifications using GCM CCS.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM