How to get device tokens (FCM registration tokens) from Firebase?
I\'m making mobile app using firebase and its server using node.js.
I want to send
The device token is generated when the app first connects, this token must then be stored in your database, and replaced if a new token is assigned
public class MyAndroidFirebaseInstanceIdService extends FirebaseInstanceIdService {
private static final String TAG = "MyAndroidFCMIIDService";
@Override
public void onTokenRefresh() {
//Get hold of the registration token
String refreshedToken = FirebaseInstanceId.getInstance().getToken();
//Log the token
Log.d(TAG, "Refreshed token: " + refreshedToken);
}
private void sendRegistrationToServer(String token) {
//Implement this method if you want to store the token on your server
}
}
See the following Tutorial