Made with heart In heart By  logo-simple Technologies

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

    configuration

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

    detail

  4. Click on Continue To Choose and Configuration Service

    continue

  5. Now in the next screen you will see a button to enable Google Cloud Messaging, click on it.
  6. Click Enable Google Cloud Messaging you will get the Server API Key and Sender ID

    cloud-messaging

  7. Scroll and click on Continue To Generate Configuration Files

    generate

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

    download

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-project1

  3. Find the created API Project and click on Project Name
  4. Copy the Project Number and it will used as GCM Sender ID

    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.
  3. If you don't have an API key, click Create new key and create with "Type: Server key, IPs: Any IP allowed".

    create-key

  4. Once done, Copy your API key it is needed for authentication
  5. On the left side bar, select APIs & auth > Credentials
  6. Select Mobile APIs > Cloud Messaging for Android in the page
  7. Check if GCM API is enabled if not click enable

    enable-gcm