Tutorial: Guide to Setup up Google Cloud Messaging (GCM) on Android

Push notifications is used to integrate real-time messaging to your apps. It keeps you stay in touch with users and makes it easy for your users to communicate. Below are the necessary steps required to add this feature to your application.

You need Sender ID and API Key for Google Cloud Messaging (GCM).

Creating a New App in Google Developers

You need to get google-services.json file contains the GCM configurations for your App to send GCM messages to Android Devices

The following instructions covers the creation Configuration file

  1. Go to Google Developers

  2. Click GET A CONFIGURATION FILE

GET A CONFIGURATION FILE

  1. Enter the App Name and Application’s package name

App Name and Application’s package name

  1. Click on Continue To Choose and Configuration Service

Continue To Choose and Configuration Service

  1. Now in the next screen you will see a button to enable Google Cloud Messaging, click on it.

  1. Click Enable Google Cloud Messaging you will get the Server API Key and Sender ID

Enable Google Cloud Messaging

  1. Scroll and click on Continue To Generate Configuration Files

Continue To Generate Configuration Files

  1. Click on Download goolge-services.json button and you will get your goolge-services.json file

Download goolge-services.json

Tutorial: Setting up Google Cloud Messaging (GCM) on Android (Old method)

Push notifications is used to integrate real-time messaging to your apps. It keeps you stay in touch with users and makes it easy for your users to communicate. Below are the necessary steps required to add this feature to your application.

You need Sender ID and API Key for Google Cloud Messaging (GCM).

1. Creating a New Project

1.1. Getting GCM Sender ID

You need GCM Sender ID to send GCM to Android Devices

The following instructions cover about the creation of a new Sender ID. If you have one goto Step 1.2

  1. Go to Google Developers Console

  2. Click Create Project

Create Project

Create Project

  1. Find the created API Project and click on Project Name

  1. Copy the Project Number and it will used as GCM Sender ID

GCM Sender ID

1.2. Getting an API Key

You’ve created a new GCM Sender ID, follow below steps to configure the API Key for GCM.

  1. Go to Google Developers Console

  2. On the left side bar, select APIs & auth > Credentials.

  1. If you don't have an API key, click Create new key and create with "Type: Server key, IPs: Any IP allowed".

Create new key

  1. Once done, Copy your API key it is needed for authentication

  1. On the left side bar, select APIs & auth > Credentials

  1. Select Mobile APIs > Cloud Messaging for Android in the page

  1. Check if GCM API is enabled if not click enable

Enable GCM API