Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FCM Vs GCM? Why we need to migrate from GCM to FCM [duplicate]

Google just announced that Google Cloud Messaging is now Firebase Cloud Messaging. What does this mean for existing users of GCM and what migration (if any) are needed?

like image 327
Patrick Avatar asked May 18 '16 22:05

Patrick


People also ask

What is difference between GCM and FCM?

FCM is a cloud platform that provides messages and push notifications for operating systems- ios and Android, and websites as well. Google Cloud Messaging is a messaging service that enables the message transfer from server to clients apps.

How do I convert GCM to FCM?

Migrate the GCM Client library to FCM Client LibrarySelect your GCM project from the list of existing Google Cloud projects, and select Add Firebase. In the Firebase welcome screen, select Add Firebase to your Android App. Provide your package name and SHA-1, and select Add App. A new google-services.

Why do we need GCM?

Using GCM, your server can notify your app running on a particular device that there is new data available for it. Compared to polling, where your app must regularly ping the server to query for new data, this event-driven model allows your app to create a new connection only when it knows there is data to download.

Is GCM deprecated?

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. Google Cloud Messaging, deprecated April 10 2018, has been deactivated and removed from Google's APIs.


2 Answers

What is FCM and why should we use it?

FCM (Firebase Cloud Messaging) is a new, improved version of the Google Cloud Messaging API under the Firebase brand. It has all the features of GCM as well as some additional features. Per the Firebase FAQ, it "inherits GCM’s core infrastructure, with new SDKs to make Cloud Messaging development easier". Google explained their decision to release FCM in their Cloud Messaging FAQ, where they wrote:

Firebase is known for being cross platform, so FCM now makes a natural fit in the Firebase suite of features designed for Android, iOS, and mobile web

Google recommends upgrading from GCM to FCM in their APIs for Android Release Notes. Reasons for doing so are given in the Firebase FAQ:

Benefits of upgrading to FCM SDK include:

  • Simpler client development. You no longer have to write your own registration or subscription retry logic.
  • An out-of-the-box notification solution. You can use Firebase Notifications, a serverless notifications solution with a web console that lets anyone send notifications to target specific audiences based on Firebase Analytics insights.

Is GCM deprecated?

Some features of GCM are already deprecated (see https://developers.google.com/cloud-messaging/android/legacy-regid, for example) and now in the coming days GCM is going to be fully deprecated. Google says:

We will continue to support the current version of GCM Android and iOS SDKs because we know a lot of developers are using GCM SDKs today to handle notifications, and client app upgrade takes time.

But all new client-side features will be added to FCM SDKs only moving forward. You are strongly encouraged to upgrade to FCM SDKs.

How to update old Android applications from GCM to FCM

From https://developers.google.com/cloud-messaging/android/android-migrate-fcm:

Import your GCM project as a Firebase project:

In the Firebase console, select Import Google Project.

Select your GCM project from the list of existing projects and select Add Firebase.

In the Firebase welcome screen, select Add Firebase to your Android App.

Provide your package name and SHA-1, and select Add App. A new google-services.json file for your Firebase app is downloaded.

Select Continue and follow the detailed instructions for adding the Google Services plugin in Android Studio.

like image 186
Robi Kumar Tomar Avatar answered Oct 09 '22 08:10

Robi Kumar Tomar


Update: There was a recent announcement via email that GCM is now deprecated and will be completely removed next year (2019), and all GCM users should start migrating to FCM. For more details, see my answer here.


In addition to what Pritam Baral's answer, note that FCM's core is composed of GCM itself. There is no actual need to migrate to it, but it is encouraged, since when migrated to FCM, all of the features tied to it will be available for use. When referring to the Firebase Official Pricings Page, the features that are included for free are:

Analytics, App Indexing, Authentication, Dynamic Links, FCM, Invites, Notifications, Crash Reporting, & Remote Config

Pre-IO GCM implementations should still work for a longer time in the future, as stated in the GCM and FCM FAQs:

We will continue to support the current version of GCM Android and iOS SDKs because we know a lot of developers are using GCM SDKs today to handle notifications, and client app upgrade takes time.

But all new client-side features will be added to FCM SDKs only moving forward. You are strongly encouraged to upgrade to FCM SDKs.


As per the recent highlights:

Firebase Cloud Messaging builds on and improves the Google Cloud Messaging API. You can keep using Google Cloud Messaging with com.google.android.gms.gcm, but we recommend upgrading to com.google.firebase:firebase-messaging.

like image 26
AL. Avatar answered Oct 09 '22 10:10

AL.