FCM和GCM是向后兼容的吗? [英] Are FCM and GCM backward and forward compatible?

本文介绍了FCM和GCM是向后兼容的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google会弃用Google Cloud消息,转而使用 Firebase Cloud Messaging


Firebase云消息传递(FCM)是GCM的新版本。它继承了
可靠和可扩展的GCM基础架构,以及新功能!请参阅
了解更多信息。如果您将消息集成到新应用中,则
从FCM开始。强烈建议GCM用户升级到FCM,
以便从现在和未来的新FCM功能中受益。 >通过我在我的服务器上进行的一些测试,FCM URL( https://fcm.googleapis.com/fcm /发送)适用于GCM项目,反之亦然 - GCM网址( https:// android.googleapis.com/gcm/send )适用于FCM项目。



迁移所有现有的GCM推送代码到FCM会节省很多麻烦,重构(我不必检查每次推送时,应用版本是FCM还是GCM)。



这种后向和前向兼容性是官方支持还是记录? / p>

解决方案

如果您引用@ IanBarber的答案 here


人们是不同的。 Firebase云消息传递(GCM)使用从Instance ID API获取注册令牌,这意味着您将获得与GCM2之间的不同令牌。



您需要发送新令牌返回给您的服务器发送消息。 在服务器端API应该完全兼容(只是FCM的新端点)


然而,如果你正在寻找任何官方文件,我不认为有明确说明。尽可能地,Google鼓励使用相应的API,端点等,具体取决于您真正打算使用的内容。


Google is deprecating Google Cloud messaging in favor of Firebase Cloud Messaging:

Firebase Cloud Messaging (FCM) is the new version of GCM. It inherits the reliable and scalable GCM infrastructure, plus new features! See the FAQ to learn more. If you are integrating messaging in a new app, start with FCM. GCM users are strongly recommended to upgrade to FCM, in order to benefit from new FCM features today and in the future.

From some tests I made on my servers, the FCM URL (https://fcm.googleapis.com/fcm/send) works with GCM projects, and vice-versa - the GCM URL (https://android.googleapis.com/gcm/send) works with FCM projects.

Migrating all existing GCM push sending code to FCM would save a lot of trouble and refactoring (I will not have to check, for each push, whether the app version is FCM or GCM).

Is this backward and forward compatibility officially supported or documented?

解决方案

If you refer to @IanBarber's answer here:

The tokens are different. Firebase Cloud Messaging (GCM) use gets registration tokens from the Instance ID API which means you'll get different tokens between that and GCM2.

You'll need to send that new token back to your server to send messages. On the server side the APIs should be fully compatible (just new endpoints for FCM).

However, if you're looking for any official documentation, I don't think there is one that explicitly states it. Since as much as possible, Google encourages the use of the corresponding APIs, endpoints, etc. depending on what you really intend to use.

这篇关于FCM和GCM是向后兼容的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆