What is Push Notification?
Push Notification (in general) and Google Cloud Messaging (android) is a service that allows you to send data from your server to your users’ Android-powered device,intimating your app that new data needs to be fetched from the server.
Assuming that you have already registered your app with Google for push notification (if not next topic will help to do that) and thus you already have an App-ID and API key.
First of all, the app sends request to Google Cloud (infrastructure) to register users’ device and in turn it returns a Registration id
Next, send the Registration id to your server with/without some more parameters (depending on your requirement) and save details on server’s database
Now, whenever there is some new information/data on your server that you want to share with users, just send the message to Google Cloud infrastructure (from your server) with list of registration id’s to which the message/notification is to be sent, and in turn GCM delivers the message to all the devices
Below diagram explains the architectural view of Google Cloud messaging
Getting Started with GCM: Creating Google API project:
Open the Google APIs Console page and click on create project
When you click create project your browser URL will show something like this
183670789232: is APP-ID(in my case) and it should be preserved, for; this is what you will be using as APP-ID
Next, select API Access from the list of options , Next click Create new Server key.The following screen appears:
If all goes well, now you have obtained APP-ID and API key