Zoe Shang
Zoe Shang

Reputation: 51

FireBase sending Tokens to server

How to send token to server in Firebase cloud messaging.I have tried the following code:

public void onTokenRefresh() {
// Get updated InstanceID token.
String refreshedToken = FirebaseInstanceId.getInstance().getToken();
Log.d(TAG, "Refreshed token: " + refreshedToken);

// TODO: Implement this method to send any registration to your app's servers.
sendRegistrationToServer(refreshedToken);

But there is an error as sendRegistrationToServer(refreshedToken); is not defined.

Upvotes: 0

Views: 3057

Answers (1)

Dark Leonhart
Dark Leonhart

Reputation: 1504

sendRegistrationToServer(refreshedToken) means to store the token into your own server. Which would be useful if you wanted to send message from your server to some certain users, or if you wanted to send a message from Firebase Console into a single device.

Upvotes: 2

Related Questions