On April 10, 2018, Google deprecated GCM. The GCM server and client APIs were removed on May 29, 2019. Migrate GCM apps to Firebase Cloud Messaging (FCM), which inherits the reliable and scalable GCM infrastructure, plus many new features. See the migration guide to learn more.

Migrate a GCM Client App for Web to Firebase Cloud Messaging

Migrate an existing GCM Web app to Firebase Cloud Messaging (FCM) using the instructions in this guide.

Update Server Endpoints

Update your server code to use new FCM endpoints for sending messages via HTTP and XMPP. Note that the new FCM version of gcm-http.googleapis.com/gcm/ is fcm.googleapis.com/fcm/ (without "http"):

GCM endpoint FCM endpoint
gcm-http.googleapis.com/gcm/ fcm.googleapis.com/fcm/
gcm-xmpp.googleapis.com fcm-xmpp.googleapis.com
android.clients.google.com/gcm/send fcm.googleapis.com/fcm/send
android.apis.google.com/*/send fcm.googleapis.com/fcm/send
android.googleapis.com/gcm/send fcm.googleapis.com/fcm/send

FCM supports HTTP and XMPP protocols that are virtually identical to the GCM server protocols, so you don't need to update your sending logic for the migration. Optionally, you may want to evaluate the FCM HTTP v1 API, which offers an improved security model and new capabilities for customizing messages across platforms.

Migrate from chrome.gcm API

The chrome.gcm API will be deprecated. The FCM JavaScript SDK is built on top of the Push API, so it works on any browser that supports the Push API, including in Chrome extensions.

Note that the FCM JavaScript SDK supports only display notifications and does not have upstream messaging capabilities. If you rely on these features, keep an eye on the chrome.gcm API migration bug.

Adopt the FCM client SDK by following the getting started guide. Some chrome.gcm functions are similar to firebase.messaging functions, such as chrome.gcm.onMessage and firebase.messaging().onMessage. Others, such as chrome.gcm.onMessagesDeleted, chrome.gcm.send, and chrome.gcm.onSendError, are not supported by the FCM client SDK.

A full list of FCM client methods can be found in the FCM JavaScript reference. To ensure you’re fully migrated, search your codebase for all chrome.gcm methods and make sure there aren’t any left.

Update Web Push API usage

  1. If you’re using the GCM JSON protocol to send to Push API clients, extract the registration_id from PushSubscription.endpoint to be able to send to specific end users with FCM.
  2. Make sure you’re using the updated server endpoints above to send messages.

Next steps and optional migration tasks

Get started with FCM

Follow the getting started guide.

Update Web Push API

Use Voluntary Application Identification when subscribing to PushManager.

Use the Web Push APIs without FCM

If you don’t want to use the FCM JS SDK, see the getting started guide for Web Push Notifications. If you'd like to access FCM features without onboarding the FCM JS SDK, you can use the InstanceID Server API to upload PushSubscriptions to FCM and access features like topic messaging.

Send feedback about...

Cloud Messaging
Cloud Messaging