Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the purpose of Google Cloud Messaging

I have been reading about google Cloud Messaging and as a developer my question is " What is this for?" Can anyone provide an example of what one would use this for? Im not looking for source code. Instead I am curious about the ideas people have for its use.

like image 930
Jack Avatar asked Feb 19 '23 18:02

Jack


1 Answers

From the Google Docs:

Google Cloud Messaging for Android (GCM) is a service that helps developers send data from servers to their Android applications on Android devices. This could be a lightweight message telling the Android application that there is new data to be fetched from the server (for instance, a movie uploaded by a friend), or it could be a message containing up to 4kb of payload data (so apps like instant messaging can consume the message directly). The GCM service handles all aspects of queueing of messages and delivery to the target Android application running on the target device

Pretty self explanatory really. It's just a mechanism for sending small messages from an external/network service to a handset for the app to act upon. It's a lot more easier than implementing a complete custom package relying on the likes of JSON or XML with a completely hand-coded protocol. (Not to say that often using tools 'off the shelf' presents a pretty elegant solution!)

In the past I was implementing a simple video podcast style app; nothing amazing - just waiting on new content from the server. In this scenario I had to specifically code things up so that the app queried the server upon launch, and then downloaded the video files. The alternative obviously being that the app queried the server every x minutes or hours.

Now with GCM I could re-write that app and have the server inform the app without the requirement for the app to initiate the action. Naturally, on a mobile this is preferable to having the app connect to the server and query it multiple times for no real reason; and it's also preferable to launching an app and having to wait whilst it requests updates from server.

The examples in the above paragraph are the obvious applications - but with some imagination it can be used for a lot more.

I think the main thing to remember though is Find a tool for the purpose, not a purpose for the tool! If you need it, it's there - but don't try and wedge it in where it's not required!

like image 90
Fergus In London Avatar answered Mar 04 '23 21:03

Fergus In London