Before we talk how to generate your GCM Sender ID and GCM Server Key, let us take a quick shot at answering these questions.
What Is GCM Service?
Google Cloud Messaging is a free service that enables developers to send messages between GCM servers and client apps. This includes downstream messages from GCM servers to client's app, and upstream messages from client apps to GCM servers. Starting 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 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.
What is the use of Server Key?
Server Key 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.
What is the difference between GCM sender ID and FCM sender ID?
Google Cloud Messaging (GCM) Sender ID: A unique numerical value which is created when you configure your Project in the Google Developers Console/ Google Cloud Console. The Project Number is 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: Equivalent of Google Cloud Messaging (GCM) Sender ID. 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 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 more about browsers supporting web push here.
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 on the Dashboard, go to Create a project from the drop down menu.
2. Enter the Project name and click on Create
3. Once the project is created, go to Overview and search for Google Cloud Messaging.
Select Google Cloud Messaging.
Enabling Google Cloud Messaging API
4. Click on Enable and move to the next step to create credentials.
5. Under the Credentials section select Create credentials and choose API key from the list.
6. From the reflected options select Server key to create a new key.
7. Enter the server key name and move to the next step by clicking on Create.
8. This is what your API key will look like.
9. To get your GCM Sender ID - select the option to Manage all projects from the drop down section.
10. Select your project from the list of all projects.
11. Go to the Settings section to view your Project number, which is your GCM 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. Keep reading post if you want to understand how GCM worked for web push notifications.
How to send notifications on mobile and desktop using GCM ?
1. Visit the iZooto website and click on 'Get Started for Free'.
2. Fill in your details along with your website URL and click on 'Get Started'
3. This will take you directly to iZooto dashboard. Here, click on 'Generate Code' to move to the next step.
4. If you have added a HTTP website, this generated code needs to be placed before your website header. However, for HTTPS website this process will have an additional step to add the code in the root directory as well. Check the steps here.
5. Choose a pricing plan to begin with. You can either choose the recommended one or start with a free trial.
6. In the next step, go to Settings > General Settings.
7. Click on 'Project Key' and then on 'Submit request for update'
8. Enter your GCM sender ID and Server Key and click on 'Submit to complete this process.
Once your GCM Project Key is updated, you can start creating campaigns and pushing out notifications to your can read more about Chrome push
Refer these to know more about Chrome push notifications, Firefox push notifications and Safari notification.
Hat Tip - Given GCM Sender ID and Server API Key are not hard bound to a particular domain. A pair of GCM Sender ID and Server API Key can be used again. GCM currently allows you add upto 12 Projects per Google Account - so ensure that you use these wisely.