Instant Messaging on Android with Google Cloud Messaging

dumazy picture dumazy · Jul 6, 2012 · Viewed 17.5k times · Source

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?

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!

Answer

appsroxcom picture appsroxcom · Jul 25, 2013

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

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

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)

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.