supermonkey supermonkey - 11 months ago 60
Android Question

Migrating from GCM to FCM in Android App

In Android App, I am migrating from GCM to FCM to send push notification.

Then I have a question.

After migration, Can I send push notification by old GCM token starting from APA・・・?

I think when I first open my app from the migration, onTokenRefresh method is not called.

So the token is still old GCM one.

If I cannot send notification by old GCM token, what is the best way to change token(from GCM to FCM token) when I first open my app from the migration?

jgm jgm
Answer Source

As part of the migration to FCM you will be given a new sender ID token that you should use at the new endpoint.

On the client you need to extend FirebaseInstanceIdService and in there the onTokenRefresh() method will be called with the new token. You should send this token to your server in the same way as you did for GCM if you want to contact your clients individually.