As per Google’s documentation "Google Cloud Messaging for Android (GCM) is a service that helps developers send data from servers to their Android applications on Android devices".
Using this service you can send data to your application whenever new data is available instead of making requests to server in timely fashion. Integrating GCM in your android application enhances user experience and saves lot of battery power.
Overview of Google Cloud Messaging
Here's how these components interact:
- Google GCM Connection Servers accept downstream messages from your app server and send them to a client app. The XMPP connection server can also accept messages sent upstream from the client app and forward them to your app server. For more information, see About GCM Connection Server.
- On your App Server, you implement the HTTP and/or XMPP protocol to communicate with the GCM connection server(s). App servers send downstream messages to a GCM connection server; the connection server enqueues and stores the message, and then sends it to the client app. If you implement XMPP, your app server can receive messages sent from the client app.
- The Client App is a GCM-enabled client app. To receive and send GCM messages, this app must register with GCM and get a unique identifier called a registration token. For more information on how to implement the client app, see the documentation for your platform.
Pre-Requirement
Preparation
Steps to follow to get Google Project ID and Android Key
1. Initial login your Google account and goto https://console.developers.google.com/apis/credentials
2. After creating project you can see Project Information at top bar in Google Console
Note the Project ID, this our Google Project ID
3. At Credential Page you need to create a Credential API Key
select the Credential Button
4. Create a new Android Key to call Google API
5. Name the Android API key
6. After Creating Android API Key a new unique API Key will be generated
Copy that key you need to past that API key in your Android Mobile APP. See the references to learn to add the key.
7. Enable Google Cloud Message
Now you have both Android Key and Google Project ID, the most important part is to enable the GCM for your project
Click on Overview at Sidebar of the Google console or visit this link https://console.developers.google.com/apis/library
Search Google Cloud Message in Search bar or see the image bellow
8. Enable GCM
Now every thing is done except the Configuration in Android App
Check the 4th references for Client Side Implementation