-2
I’m trying to get Firebase Cloud Messaging to send a message to a specific user but I’m not getting... First I am registering the device and saving the id on my server:
FirebaseInstanceId.getInstance().getInstanceId()
.addOnCompleteListener(new OnCompleteListener<InstanceIdResult>() {
@Override
public void onComplete(@NonNull Task<InstanceIdResult> task) {
if (!task.isSuccessful()) {
Log.w(TAG, "getInstanceId failed", task.getException());
return;
}
// Pega o ID token
String token = task.getResult().getToken();
// depois envia para o servidor
saveToken(token);
}
});
So I try to send my message through the back-end to:
https://fcm.googleapis.com/fcm/send
With the id that was registered in the database
As in this example tutorial: