Android APP migrates from GCM to FCM. Old GCM toke

2019-08-22 01:06发布

问题:

The document from Google says:

GCM tokens retrieved via GoogleCloudMessaging.register() or InstanceID.getToken() will continue to work in FCM without any modification or renewal.

But when I update my APP to FCM. The old GCM token which stores in my Server does not work anymore. When I tried to send a push message, the Google Message server response the error message, not registered. Does anyone ran into the same problem?

回答1:

Based from the documentation of GCM and FCM FAQ:

Will your existing GCM tokens and token handling still work?

Your GCM and FCM registration tokens are mutually interchangeable; you can send to existing GCM tokens through the FCM HTTP server APIs. For GCM and FCM token handling, remember:

  • If you store and send to specific tokens, be sure to implement the token refresh method to ensure your tokens are always up to date
  • iOS devs should avoid calling .getToken(authorizedEntity,scope) unless there is a need to enable multiple senders. Use FirebaseInstanceId.getInstance().getToken() instead.