On April 10, 2018, Google deprecated GCM. The GCM server and client APIs were removed on May 29, 2019, and currently any calls to those APIs can be expected to fail. 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 GCM to an existing Firebase project

If you already have an existing Firebase project into which you would like to migrate a GCM app and its users, there are special steps you must perform. These special steps are required because the existing Firebase project will not be able to send messages to tokens belonging to a completely separate GCM project. Until all client app instances upgrade to your Firebase app, you'll need to create a mapping between old GCM tokens and the Firebase project.

  1. Update your app's client-side code and server endpoints to use FCM as described in steps 2-5 of the normal flow with one important exception: use the google-services.json file from your existing Firebase project.
  2. Use the getToken method with no parameters and store your new tokens, making sure to associate them with your existing Firebase project and server key (that is, store the Firebase project ID alongside the token).
  3. If you send to topics, unsubscribe old tokens from all of your old GCM project's topics and re-subscribe to equivalent topics for the existing Firebase project.
  4. Continue to use your old server key to reach your existing GCM instances until those instances successfully upgrade their client to the FCM version.