将 GCM 迁移到 FCM,我应该/可以保留当前 GCM 服务器端的代码吗?

2024-08-22php开发问题
9

本文介绍了将 GCM 迁移到 FCM,我应该/可以保留当前 GCM 服务器端的代码吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

根据 https://stackoverflow,我一直在使用 GCM 服务在 PHP 服务器中向我现有的应用程序发送通知.com/a/11253231/3286489.

现在我正在考虑迁移到 FCM.根据 https://stackoverflow.com/a/37517339/3286489,通知服务 URLhttps://android.googleapis.com/gcm/send" 已更改为 "https://fcm.googleapis.com/fcm/send"

Now I'm thinking of migrating to FCM. As per noted https://stackoverflow.com/a/37517339/3286489, the notification service URL "https://android.googleapis.com/gcm/send" has been changed to "https://fcm.googleapis.com/fcm/send"

由于我还是新探索 FCM,我希望我的问题不是转储.我有两个问题.

As I'm still newly explore the FCM, I hope my question is not dump. I have two questions here.

1.) 一旦在我的客户端中迁移到 FCM,我是否仍然可以使用发送 GCM 的相同 PHP 代码,按照 https://stackoverflow.com/a/11253231/3286489?或者我可以只更改 API URL(到 fcm.googleapis.com)但保留所有 PHP 代码吗?(即 'https://fcm.googleapis.com/fcm/send' 向后兼容与'https://android.googleapis.com/gcm/send'?)

1.) Once migrated to FCM in my client, can I still use back the same PHP code that send my GCM as per https://stackoverflow.com/a/11253231/3286489? Or could I just change the API URL (to fcm.googleapis.com) but retain all PHP code the same? (i.e. is 'https://fcm.googleapis.com/fcm/send' backward compatible with 'https://android.googleapis.com/gcm/send'?)

2.) 迁移到 FCM 后(在服务器推送上),即使在我升级我的应用程序以使用 FCM 而不是 GCM 之后,我相信仍然会有一些用户坚持使用旧应用程序一段时间使用 GCM.当我发送推送通知时,是否需要分别发送到 FCM 和 GCM(即我需要保留旧的 GCM 服务器代码一段时间)?或者我只需要发送 FCM,我的旧 App(只有 GCM)仍然会收到它?

2.) Upon migrated to FCM (on the server push), and even when after I have upgraded my App to use FCM instead of GCM, I believe there will still be some user that's stick to the older App for a while using GCM. When I send push notification out, do I need to send to both FCM and GCM separately (i.e. I need to keep the old GCM server code for a while)? or I just need to send the FCM, and my old App (with only GCM) will still receive it?

我希望两者的答案都是肯定的,但感觉不太可能是肯定的.所以写信确认我的理解.

I hope the answer is yes for both, but feel like not likely it's yes. So write to confirm my understanding.

推荐答案

答案都是肯定的.

对于 #1,我的 帖子 几乎可以回答它.所以只是为了确认,使用 FCM 端点发送给你的 GCM 用户应该没问题.它仍然兼容.

For #1, my post that you linked pretty much answers it. So just to confirm, using the FCM endpoint to send towards your GCM users should be fine. It's still compatible.

对于 #2,无需为 GCM 用户发送单独的有效负载.正如我上面所说,它是向后兼容的.

For #2, no need to send separate payload for GCM users. As I said above, it is backwards compatible.

这篇关于将 GCM 迁移到 FCM,我应该/可以保留当前 GCM 服务器端的代码吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

PHP实现DeepL翻译API调用
DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以...
2025-08-20 php开发问题
168

PHP通过phpspreadsheet导入Excel日期数据处理方法
PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的...
2024-10-23 php开发问题
287

mediatemple - 无法使用 codeigniter 发送电子邮件
mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)...
2024-08-23 php开发问题
11

Laravel Gmail 配置错误
Laravel Gmail Configuration Error(Laravel Gmail 配置错误)...
2024-08-23 php开发问题
16

将 PHPMailer 用于 SMTP 的问题
Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)...
2024-08-23 php开发问题
4

关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题
Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)...
2024-08-23 php开发问题
17