Most likely, your app needs real time updates for dynamic content or for more user engagement. Earlier we used to have polling mechanism to refresh the data. Polling is too expensive to the system as it consume server and client resources even if there are no updates. To solve this we need push notification from server and here GCM (Google cloud messaging) help us.
Google Cloud Messaging is a free service from Google to send push notifications to device on demand.
Enabling GCM to your application:
There are two part of it. One is authentication of server and another is identification of device. We will go through step by step for each part.
1 . Server Authentication:
a ) Enable API : To get the server key go to Google developer console and select your project from top drop down menu. Once you select your project you can see your project details. Please note down your project number.
Click on the APIS & auth and select API . In mobile API, select “Cloud Messaging for Android” and enable the API.Read More