即时通讯在Android与谷歌云消息传递即时通讯、消息、Android、谷歌云

2023-09-04 10:11:30 作者:卟幺¤菽麸

我只是在寻找新的谷歌云消息(GCM),我想知道是否有可能在你的Andr​​oid应用程序中使用GCM即时消息?

I was just looking at the new Google Cloud Messaging (GCM) and I was wondering if it is possible to use GCM for Instant Messaging on your Android application?

我看到你发送的数据,这样的消息,从服务器,但它也可以从一个手机发送到另一个? 而如何将这项工作? 有些例子code将是非常有益的。

I saw you can send data, like a message, from a server, but is it also possible to send from one device to another one? And how would this work? Some example code would be really helpful..

TNX!

推荐答案

在官方文档在谷歌云消息为Android也提到GCM可用于开发的即时消息应用程序。

The official docs on Google Cloud Messaging for Android does mention that GCM can be used to develop an instant messaging app.

...或者它可以是含有最多有效负载数据的4kb的(这样的消息   例如即时消息应用程序可以直接使用该消息)。

...or it could be a message containing up to 4kb of payload data (so apps like instant messaging can consume the message directly).

所以我们说干就干,使用GCM创建一个即时消息应用程序。服务器端是由谷歌应用程序引擎提供动力。你可以在这里阅读完整的教程。 使用创建一个即时消息应用程序,谷歌云消息(GCM)

So we went ahead and created an instant messaging app using GCM. The server-side is powered by Google App Engine. You can read the complete tutorial here. Create an Instant Messaging app using Google Cloud Messaging (GCM)

因此​​有可能使用GCM在Android即时消息,回答你的问题。然而,GCM相比XMPP的即时通讯的可靠性是另一个话题。

So it is possible to use GCM for Instant Messaging on Android, to answer your question. However, reliability of GCM compared to XMPP for IM is another topic.