Oh no Google did it again! This was my first reaction when I started implementing push notification in one of my projects. After going through the Docs I figured out that Google has changed the previous way of implementing push notification.
So I decided to write about the new ways of implementing push notification so that it could help fellow developers.
1. Create Project on Google Developer Console: While most of you would already know how to do that, there’s no need to worry even if you don’t, just follow the steps mentioned here- http://developer.android.com/google/gcm/gs.html
After project creation, a unique Project ID and Project Number are generated for your project.
Don’t forget to copy and save them for future use.
2. Enable the GCM Service
Inside the developer console (https://console.developers.google.com) you will see a side bar on the left hand side, where you will find APIs & Auth, select that, and a list of Google APIs will pop up in front of you.
Try to find the Google Cloud Messaging for Android and click on it to ON.
The GCM service is now enabled!
3. Get an API Key
When APIs & Auth is expanded, you must find Credentials, clicking on which will make you find two sections- OAuth section and Public API access Section. In the Public API access Section, you would also find a red button, “Create new Key”, clicking on which will give you an API key that you need to save for future use.
Now that you have created your project, enabled the GCM service, and yes, generated API key also, so you are good to go ahead and implement push notification in your application. However, before implementing that make sure that you have set up your project to use Play Services SDK.
4. Now Add Some Permission To your Manifest File
5. And some Copy Paste of Codes
Finally, you just need to show your copy pasting skills. Go through the link, http://developer.android.com/google/gcm/client.html, and follow the step 3. And voila! You have the push notification functionality in your application- now you can raise your hands and say, “Yes! I have done it!”
Posted by- Azhar Eqbal
Disclaimer: Developer’s Corner Section of ISHIR blog is contributed and maintained by independent developers. The content herein is not necessarily validated by ISHIR.