Let me put it simple, it is a service that allows developers to send data from servers to their ANDROID applications on the android powered devices or also to the chrome app and extensions. It also includes upstream messaging by which your application can send messages to the servers.
But that’s what the earlier versions provided us with . So what’s new in 2014 ? In November 2012 GOOGLE I/O was released and over the way GOOGLE has made a lot of improvements in terms of being faster, more reliable, scalable, opened it to all developers and with a bunch of new and amazing set of APIs – says Francesco Nerieri, who leads the CLOUD team in ANDROID.
On the bottom-line , if suppose you have an Android Application and a server and you want to exchange data, here is where GCM comes in. For example , there are millions of photos getting uploaded via an application and a large number of photographers and other clients use this application. So if we have to send a notification that new pictures or videos have been uploaded , we first send the message to GCM ,even if the device is offline it stores the messages locally and sends them again once the device comes online. The technology is enthralling.
So how has it grown so simple ? Its true that google must be supporting a ten-thousand lines of code or even more to provide such a powerful yet simplified experience to the user , absolutely free! A list of powerful APIs make this tangible as described by Subir jhanb , head of GCM at GOOGLE.
The four most basic APIs supported by the GCM are as follows , they help in the basic functionality for what GCM provides.
This is the first step of the process , to use the services we need a unique registration id with some lines of python code . Yes, its that simple now. Authentication follows as the next step wherein only the PROJECT ID and API KEY are required which is then followed by a success or an error message from the service.
After your registration you are all set to exchange messages , with no more curves on the road. There is a smart feature attached to it , wherein a time to live field is used that controls the expiration time of the message . A very simple analogy can be explained , suppose there is an application that tells the users of the app a perfect time for surfing based on the wind tide and other conditions. But what if the device is offline and the conditions change in an hour or so . The GCM automatically deletes the notification after the specified time as it is no longer useful for the user. This is achieved by the TIME TO LIVE API.
Another special feature is a DELAY WHILE IDLE which gives some sort of priority for the messages. if the device is connected but idle it does not allow messages to be sent immediately , it waits for the application to be active and sends the latest notification based on the latest collapse key. For instance : A sports app may be sending the scores for a match , but the application is offline or idle , in this case as and when the user is active the latest score is send .
3) Multiple Servers:
GOOGLE always provides you with the best and the most accurate. Taking the same surfing analogy , suppose one server just provides information about the temperature , high tides , rains etc but not the weather conditions of the region. In that case the information is inaccurate as one of the most important criteria’s , the wind patterns are not taken into account. So the developer can use another server that provides wind pattern information along with the other servers to give a combined information that vouches for accurate and appropriate weather data over the region.
Via an open HTTPS connection , this messaging service allows1000 recipients for a single message for a particular application. Yes the number is huge.
The basic APIs are such a standout , definitely there is more to it.Now let us look at some outstanding increments that GOOGLE has come up with. It starts with the XMPP endpoint.
- XMPP endpoint stands for (extensible messaging and presence protocol) is similar to the HTTP endpoint , you must be thinking then why is it included ? It stands out in a way that it provides persistent, asynchronous, bidirectional connection to the servers which facilitates the sending and receiving of messages between your server and your users’ GCM-connected devices. It allows to send more messages by using less resources and provides the service with upstream messaging.
- By using XMPP we can send over 4000 messages in a second which becomes 40,000 when multiplied by a factor of 10, as it provides users with 10 parallel connections. Another stunning feature that makes it even more powerful is that it is on the user which endpoint he wishes to use. For e.g.: XMPP can be used while streaming , HTTP for multicasting and when massive throughput is the requirement a combination of both can be used.
- Upstream messaging: This feature allows the application on your device to send messages to the server. Rest follows the same as downstream messaging. Its faster because a handshake is not required prior to sending messages.
There are some heuristics you need to follow, as now the GCM comes up with better error handling.
- It allows a maximum payload message of 4Kb.
- All the messages have to acknowledged , once acknowledged they are dropped from the cloud . If not, a maximum of 20 unacknowledged messages can be stored for a device . Also if your device is offline for more than 24 hours the messages are dropped from the cloud.
- The best part about any service is that it should be compatible with its predecessors , it powers all Android devices from FROYO+ up till KITKAT , u don’t need to change configurations it just makes itself compatible.
- It feels good and assured to be notified what happened to the message that you sent ? If Gmail stops prompting that your message has been sent imagine the havoc that will be caused. So tantamount to it , GCM also provides it to you the DELIVERY RECEIPTS. You get to know what’s up with your messages.
All the features have been looked upon , but for such great technology you need to encompass all aspects .People can have multiple android powered devices: I have a Smartphone , i have a tablet and i have a phablet too.It rings a bell. So will i be receiving notifications on all of the devices or just the one that i am using ? Give it a rest . It is smart so it detects which of the device is active and it sends notifications on that. If all three are idle due to some reason then what does it do? Its smarter than you expect. It detects the device that was active the most recently and sends notification to it.
The user may choose to get notifications on all devices as well, something captivating is still in store. When the server gets an acknowledgement from user and if user deletes that message from any one of that device it is reflected on the others as well. Isn’t that just too amazing. Technically it is.
It also helps the ecosystem with the impact it has on the battery life radio signal and network usage as said by the GOOGLE CLOUD MESSAGING team.
Here are few highlights about of Google Cloud Messaging (GCM) service:
- With GCM , 3rd-party application servers can send messages to their Android applications.
- An Android application on an Android device doesn’t need to be running to receive messages.
- Raw message is passed by GCM is sent straight to the Android application which has full authority to decide on how to handle it. For example, the application might display a custom user interface, silently sync data, or post a notification.
- It requires devices powered by Android 2.2 or higher and is compatible with all the higher versions.
Author’s Bio – I love to research, write and read about new technologies, gadgets, Smartphones, apps, reviews and other tech updates. My current interest is in writing Smartphone reviews, for hotter tech contents you can visit inewtechnology.com.