android - 需要从 GCM 迁移到 FCM?

标签 android firebase google-cloud-messaging firebase-cloud-messaging

Google 刚刚宣布 Google Cloud Messaging 现在更名为 Firebase Cloud Messaging。这对 GCM 的现有用户意味着什么?需要进行哪些迁移(如果有)?

最佳答案

什么是 FCM,我们为什么要使用它?

FCM(Firebase 云消息传递)是 Firebase 品牌下 Google Cloud Messaging API 的新改进版本。它具有 GCM 的所有功能以及一些附加功能。根据 Firebase FAQ ,它“继承了 GCM 的核心基础架构,使用新的 SDK 使云消息传递开发更容易”。 Google 在其 Cloud Messaging FAQ 中解释了他们发布 FCM 的决定。 ,他们写道:

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 建议在其适用于 Android 的 API 中从 GCM 升级到 FCM Release Notes . 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.

GCM 是否已弃用?

GCM 的某些功能已被弃用(例如,参见 https://developers.google.com/cloud-messaging/android/legacy-regid),现在在未来几天内将完全弃用 GCM。 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.

如何将旧的 Android 应用程序从 GCM 更新到 FCM

来自 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.

关于android - 需要从 GCM 迁移到 FCM?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37311188/

相关文章:

php - 推送通知服务器端实现

android - 需要从 GCM 迁移到 FCM?

iOS Firebase 推送通知仅收到第一个 token ,不再收到 token 更改后

javascript - 如何实时查询firestore?

java - NoClassDefFoundError 和 ClassNotFoundException

java - PhoneGap 2.9.0 插件示例

java - Android 即时功能 : Is it something fundamentally flawed with this approach?

android - gcm 推送通知,渐进式 webapp

android - 在 Cordova 点击文本框后显示顶部和底部菜单

java - 运行应用程序时的 IntelliJ MyClass.class(没有这样的文件或目录)