我开始使用 Google Cloud Messaging 编写一些应用程序,但服务器出现问题。我使用了 Android 开发者端的代码 - 使用 Smack 库的 Java 示例(我不会在这里上传代码,因为它很长):
我在 Google APIs 上打开了 Google Cloud Messaging 并更改了我的 SENDER_ID、API KEY 和 Registration_ID,但是当我启动程序时出现如下错误:
gcm.googleapis.com:5235 Exception: XMPPError connecting to gcm.googleapis.com:5235.; : remote-server-error(502)
at org.jivesoftware.smack.XMPPConnection.connectUsingConfiguration(XMPPConnection.java:604)
at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:1026)
at SmackCcsClient.connect(SmackCcsClient.java:248)
at SmackCcsClient.main(SmackCcsClient.java:342)
Exception in thread "main" java.lang.IllegalStateException: Not connected to server.
at org.jivesoftware.smack.XMPPConnection.sendPacket(XMPPConnection.java:495)
at SmackCcsClient.send(SmackCcsClient.java:132)
at SmackCcsClient.main(SmackCcsClient.java:357)
SmackCcsClient.java:248 -> `connection.connect();`
SmackCcsClient.java:342 -> `ccsClient.connect(userName, password);`
SmackCcsClient.java:132 -> `connection.sendPacket(request);`
SmackCcsClient.java:357 -> `ccsClient.send(createJsonMessage(toRegId, messageId, payload, collapseKey,timeToLive, delayWhileIdle));`
也许你知道我做错了什么?