将GCM迁移到FCM,我应该保留现有的GCM服务器端代码吗? [英] Migrating GCM to FCM, should/could I keep my current GCM server side of code?

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

问题描述

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



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



由于我还在重新探索FCM,所以我希望我的问题不是转储。我有两个问题在这里。
$ b <1>。)一旦我的客户端迁移到FCM,我仍然可以使用相同的PHP代码发送我的GCM按照 https://stackoverflow.com/a/11253231/3286489 ?或者,我可以只更改API URL(到fcm.googleapis.com),但保留所有PHP代码相同? (即 https://fcm.googleapis.com/fcm/send '向后兼容与 https://android.googleapis.com/gcm/send ?) 2)在迁移到FCM(在服务器上推)时,甚至当我升级我的应用程序使用FCM而不是GCM后,我相信仍然会有一些用户坚持使用GCM一段时间的旧应用程序。当我发送推送通知时,是否需要分别发送到FCM和GCM(即,我需要将旧的GCM服务器代码保留一段时间)?或者我只需要发送FCM,我的老应用程序(只有GCM)仍然会收到它?

我希望对于这两个答案是肯定的,但感觉像不太可能是的。所以写下来确认我的理解。

解决方案

b

对于#1,我的发布,你链接了很多答案。所以只需确认,使用FCM端点发送给您的GCM用户应该没问题。 它仍然兼容



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


I've been using GCM service to send notification to my existing App, in PHP server, as per https://stackoverflow.com/a/11253231/3286489.

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"

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

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.) 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.

解决方案

The answer to both is Yes.

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.

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

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

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