Google Cloud Messaging

Google Cloud Messaging (GCM) is a free service that helps Android developers to send data from servers to their Android applications, and upstream messages back to the cloud from the user’s device. This can be a lightweight message telling the Android app that there is a new data to be fetched from the server or it can be a message containing up to 4kb of payload data. The GCM service handles all the aspects of queuing of messages and delivery to the target Android application running on the target device.

Characteristics of GCM

Allows 3rd-party application servers to send messages.

Using GCM Cloud Connection Server, you can receive upstream messages from the user’s device.

Android application doesn’t need to be running on a device to receive messages. When the message arrives, system will wake up the Android application via Intent broadcast, as long as the application is set up with the proper broadcast receiver and permissions.

Built-in user interface or other handling for message data is not available, GCM simply passes raw message data straight to the Android application that has full control of how to handle it.

Key Concepts of GCM

2) Credentials : These are IDs and tokens used in different stages of GCM to ensure authentication of all parties and the message is going to the correct place.

1) GCM Components

Client App – It is a GCM-enabled Android application running on a device. This must be 2.2+ Android OS device with Google Play Store installed, and it must have at least one logged in Google account if the device is running a version lower than Android 4.0.4.

3rd party Application Server – An application server that you write as part of implementing GCM. The 3rd-party application server sends data via the GCM connection server to Android application on the device.

GCM Connection Server – These are Google-provided servers involved in taking messages from the 3rd-party application server and sending them to the device.