I am trying to send notification one to one (chat message). So if X send message to Y, X will hit the api googleapis :
POST https://fcm.googleapis.com/v1/projects/myproject-b5ae1/messages:send
{
"message":{
"token":"bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1...",
"notification":{
"body":"This is an FCM notification message!",
"title":"FCM Message"
}
}
}
I get it from the documentation firebase : https://firebase.google.com/docs/cloud-messaging/migrate-v1.
So for sending message to Y, I need ID Device token of Y right, is there anyone know how to retrieve it ? as I know this code below only retrieve my ID Device token:
FirebaseMessaging messaging = FirebaseMessaging.instance;
String? token = await messaging.getToken();