What happens to older clients when you migrate an app server from GCM to FCM?
Using FCM (an imported project or using it's endpoint, whichever you mean) is still compatible with GCM clients (specifically tokens). They'd still be able to receive messages like usual.
See these similar posts:
- https://stackoverflow.com/a/37517339/4625829
- https://stackoverflow.com/a/42674121/4625829
Migrating GCM to FCM, should/could I keep my current GCM server side of code?
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.
Migrate from gcm to fcm in the server
There is no FCM client library. It is actually supported by the one you already use.
You can specify to which endpoint a message should be sent in the constructor for Sender
.
Sender sender = new Sender(apiKey, Constants.FCM_SEND_ENDPOINT);
Message message = new Message.Builder()
.addData("message", "a message")
.build();
Result result = sender.send(message, registrationId, numberOfRetries)
Note that if you do not specify an endpoint, it defaults to FCM.
If you are using a recent version of the lib, you probably don't have to change anything.
Migration from GCM to FCM needed?
Update: There was a recent announcement via email that GCM is now deprecated and will be completely removed next year (2019), and all GCM users should start migrating to FCM. For more details, see my answer here.
In addition to what Pritam Baral's answer, note that FCM's core is composed of GCM itself. There is no actual need to migrate to it, but it is encouraged, since when migrated to FCM, all of the features tied to it will be available for use. When referring to the Firebase Official Pricings Page, the features that are included for free are:
Analytics, App Indexing, Authentication, Dynamic Links, FCM, Invites, Notifications, Crash Reporting, & Remote Config
Pre-IO GCM implementations should still work for a longer time in the future, as stated in the GCM and FCM FAQs:
We will continue to support the current version of GCM Android and iOS SDKs because we know a lot of developers are using GCM SDKs today to handle notifications, and client app upgrade takes time.
But all new client-side features will be added to FCM SDKs only moving forward. You are strongly encouraged to upgrade to FCM SDKs.
As per the recent highlights:
Firebase Cloud Messaging builds on and improves the Google Cloud Messaging API. You can keep using Google Cloud Messaging with com.google.android.gms.gcm, but we recommend upgrading to com.google.firebase:firebase-messaging.
Migrating from GCM to latest FCM but get the same Token
A registration token is "implicitly linked to the package name of the app + device where it was generated" -- so it is plausible that the device returns the same token if it is for the same app and the same project. Even though the answer is quite old (GCM days), I believe that this behavior still stands. This makes sense because the backwards compatibility for GCM and FCM is still active (similar post).
Related Topics
Disable The Swipe Gesture That Opens The Navigation Drawer in Android
Using Android Google Maps V2 with Custom View or Imageview
How to Convert Date Format in Android
Sqlitedatabase Close() Function Causing Nullpointerexception When Multiple Threads
How to Show a Mediacontroller While Playing Audio in Android
How to Close Activity and Go Back to Previous Activity in Android
What Are The Semantics of Withvaluebackreference
Stackoverflow: Caused by Nested Views
Firestorepagingadapter Not Receiving Realtime Updates
Android: Save File Permanently (Even After Clear Data/Uninstall)
Captured Photo Orientation Is Changing in Android
Find the Physical Address of Exception Vector Table from Kernel Module
How to Load Image into Imageview from Url Using Glide V4.0.0Rc1