简体   繁体   中英

Migrate from gcm to fcm in the server

in this article ( https://developers.google.com/cloud-messaging/android/android-migrate-fcm#update-server-endpoints ) it says that for migrating from gcm to fcm all you need to do in the server is change the endpoint.

but how do i do this?

currently i'm using gcm client library for Java. what exactly do i need to do? i couldn't find anywhere instruction how to update the endpoint.

do i need to stop using the gcm client library and move to the fcm client library?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM