从GCM迁移到FCM,而无需更改Android本机代码?

时间:2018-10-30 08:21:47

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

Google Developer页面已发布如下消息:

As of April 10, 2018, Google has deprecated GCM. The GCM server and client APIs are deprecated and will be removed as soon as April 11, 2019. Migrate GCM apps to Firebase Cloud Messaging (FCM), which inherits the reliable and scalable GCM infrastructure, plus many new features. See the migration guide to learn more.

并且来自firebase.googleblog.com

If you have projects that are still using the GCM APIs, you will need to update your client and server code to use FCM before April 11, 2019. But rest assured, your existing GCM tokens will continue to work with FCM so you won't lose the ability to send messages to your existing users.

我对这些消息感到困惑。这是什么意思吗?

  1. 将服务器的端点更改为FCM的端点:fcm.googleapis.com/fcm/fcm-xmpp.googleapis.com(此时可以更改)
  2. 我们必须将应用更改为使用FCM库而不是GCM(gcm.jar)库吗?还是我们可以保留旧的GCM(gcm.jar)并仅更改服务器?

还有关于Google推送通知的内部工作的问题:

  1. 关闭GCM后,以前具有GCM(gcm.jar)代码的用户如何继续接收通知?这是否意味着GCM库只是接收令牌和通知消息的中间媒介(即,推送通知重定向器)? Google是否有机制重定向到正确的通知URL,如下图所示?

Guessing push mechanism?

更新:

  1. 我研究了com.google.android.gcm(在https://chromium.googlesource.com/android_tools/+/master/sdk/extras/google/gcm/gcm-client/src/com/google/android/gcm上)的源代码;它不包含任何直接链接到GCM或推送通知服务器的URL。似乎可以通过Google Play服务(How GCM connection Servers sends messages to an Android device?)工作,因此Google Play服务是否根据项目ID(或其他信息)确定FCM或GCM的URL?

0 个答案:

没有答案
相关问题