Over a million developers have joined DZone.

Generating Your GCM Sender ID and Server Key for Chrome Push

DZone 's Guide to

Generating Your GCM Sender ID and Server Key for Chrome Push

Firebase, Google's cloud-based tool suite, can help add flexibility and user friendliness to apps. This guide walks you through setting up push notifications.

· Cloud Zone ·
Free Resource

Google Cloud Messaging (GCM) is a free service that enables developers to send messages between servers and client apps. This includes downstream messages from servers to client apps and upstream messages from client apps to servers. Starting in May, Google Cloud Messaging Platform is being replaced by Firebase Cloud Messaging.

Before 2014, GCM could only be used to send downstream messages (cloud-to-device) via HTTP. A GCM message sent with the HTTP API can be sent up to 1000 users, requiring multiple messages for large numbers of users. The new API offers an alternate method using XMPP, the GCM Cloud Connection Server. The CCS allows for a constant connection to Google’s GCM servers and messages to be sent at the max wire speed. Google throttles this speed to be 4,000 messages per second at maximum, per connection; with a 10-connection maximum. When using all 10 connections you can send 40,000 messages per second. A key difference is that messages sent using Google’s CCS is one message per device, rather than messages with multiple recipients.

Some key features of this Google Cloud Messaging Server are:

  • Versatile messaging target.
  • Downstream Messaging.
  • Upstream Messaging.

Watch this video to understand more about GCM:

What Is Firebase Cloud Messaging?

Firebase Cloud Messaging (FCM): Firebase is the new and evolved version of GCM. Firebase comes with lot of new features along with the obvious reliability and scalable GCM infrastructure. Read more about Firebase here.

How Do I Use a Server Key?

Server Key: This is the key saved on the app server that provides the app server authorized access to Google services. As a recommended practice, you should never include the API key anywhere in your client code.

GCM Sender ID vs. FCM Sender ID?

Google Cloud Messaging (GCM) Sender ID: A unique numerical value that is created when you configure your project in the Google Developer Console/ Google Cloud Console. The Project Number is the GCM Sender ID, and this is used in the registration process to identify an app server that is permitted to send messages to the client app.

Firebase Cloud Messaging/FCM Sender ID: This is the equivalent of the Google Cloud Messaging (GCM) Sender ID. It's accessible under the Firebase > Project > Settings > Cloud Messaging tab.

What Are Chrome Push Notifications?

Chrome web push notifications are clickable messages that are sent to the Chrome browser on your user’s device. These modifications can only be sent to your subscribed users. In order to get these notifications, the subscribers do not have to be on your website. Your users can easily subscribe to these notifications on mobile, desktop, and tablet.

Read here more about web push notifications and all the other browsers that it supports.

Steps to Generate Your Google Cloud Messaging (GCM) Sender ID

1. Sign into your Google Cloud Platform Account on https://console.developers.google.com

Once in the dashboard, go to Create a project from the drop down menu.

GCM Sender ID and Server Key

Generating GCM Sender ID – Step 1- Project Creation

2. Enter the Project name and click on Create

Create GCM Sender ID and Server Key

GCM Project Creation

3. Once the project is created, go to Overview and search for Google Cloud Messaging.

Select Google Cloud Messaging.


Create GCM Sender ID and Server Key

Enabling Google Cloud Messaging API


GCM Sender ID and Server Key

Google Cloud Messaging API

4. Click on Enable and move to the next step to create credentials.


Create GCM Sender ID and Server Key

Confirmation of Activation of GCM API


Create GCM Sender ID and Server Key



Create GCM Sender ID and Server Key

GCM API Credentials

5. Under the Credentials section, select Create credentials and choose API key from the list.

Create GCM Sender ID and Server Key

GCM Sender ID and API Creation

6. From the reflected options select Server key to create a new key.

Create GCM Sender ID and Server Key

New Key Generation

7. Enter the server key name and move to the next step by clicking on Create.

Create GCM Sender ID and Server Key

Name Server Key

8.  This is what your API key will look like.

Create GCM Sender ID and Server Key

Server Key Generated

9. To get your GCM Sender ID – select the option to Manage all projects from the drop down section.

GCM Sender ID and Server Key

Manage Projects in GCM

10. Select your project from the list of all projects.

Create GCM Sender ID and Server Key

GCM Sender ID

11. Go to the  Settings section to view your Project number, which is your GCM Sender ID.

Create GCM Sender ID and Server Key

Project Number is Sender ID

GCM is now FCM!

If you have followed this tutorial about GCM, we strongly recommend you migrate to Firebase cloud messaging today itself. Read here to understand what’s changed and get started by generating your server key using these easy steps. 

gcm ,firebase ,tutorial ,cloud ,push notification

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}