I am trying to send notification to single device using firebase. I write the information I get with the Log("Token:" & GetToken) code to the Id section, but still all devices are notified. Where am I doing wrong?
For Example
Single device notification:
Private Sub SendMessage2(id As String, Title As String, Body As String)
Dim Job As HttpJob
Job.Initialize("fcm", Me)
Dim m As Map = CreateMap("to": $"${id}"$)
Dim data As Map = CreateMap("title": Title, "body": Body)
m.Put("data", data)
Dim jg As JSONGenerator
jg.Initialize(m)
Job.PostString("https://fcm.googleapis.com/fcm/send", jg.ToString)
Job.GetRequest.SetContentType("application/json;charset=UTF-8")
Job.GetRequest.SetHeader("Authorization", "key=" & API_KEY)
End Sub
Single device notification:
SendMessage2("eleYgmQySGCe9yJnZBcWpR:APA91bFtjyTHoVLTZo_w88JLrQhtbu5vsckhy..................", "title", "body")