问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/39555998/are-fcm-and-gcm-backward-and-forward-compatible