How to create project on Google Developer Console and generate credentials for Google Cloud Messaging (GCM)

In previous article I have explained complete process flow of google cloud messaging. After understanding this process and starting developing application we have create a project on google console to get few parameters to use in the application.

These parameters are:

  1. Project Number: This will be used as Sender Id
  2. API Key: This will used as API Key to authenticate our request on GCM server
  3. Enable Google Cloud Messaging API for Android

To sending notification from server to your android device we have do following steps before doing any coding:

  1. Go to Google developer console: Go to https://console.developers.google.com and login with you google account.
  2. Create a project: Select Create a project option from option on top right of the screen (See screenshot below).
    google developer console create project

    Enter your project name in pop

    Now click create. This will create the project and redirect you o the project page.  If you are not automatically redirect to the project page you can select from same link where we chose create a project option.

  3. Generate credentials: After creating project and opening project dashboard first thing we will use is project number. This project number will be used as sender id for sending notification. After that we need to activate the Cloud Messaging API, for this

    open site menu and select API Manager -> Overview -> Cloud Messaging for Android

    Now you will see Enable API button on top of this tab so just click on it and wait for the operation to get completed. after enabling messaging API we can use this project for Google Cloud Messaging.

    Now last thing we need to do is to get API Key which is mandatory to use any API. Click on Credential in left sidebar -> click Add credentials -> select API key. A pop will open which will show 4 buttons we have to use server as we will use this API key on our server to send messaged to GCM server. It will ask you a key name and when you click create a popup will open containing your API Key. We will use this API key to send messages from server to GCM Server.

So in this article we learnt how to:
  • Create project on google cloud console
  • Get project number to use as sender id for GCM messages
  • Enabling Cloud Messaging API for Android
  • Generating API key to authenticate your request on GCM server
In coming articles we will learn:
  • Generating registration id for android application
  • Sending notification from app server to GCM
  • Get messages on mobile app and display on notification bar

Leave a Reply

Your email address will not be published.