B4X:
' this UI app is not sending message from FCM
'the strings are populated via textfield and textarea
Private Sub SendMessage(Topic As String, Title As String, Body As String)
Dim Job As HttpJob
Job.Initialize("fcm", Me)
Dim m As Map = CreateMap("to": $"/topics/${Topic}"$)
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")
Job.GetRequest.SetHeader("Authorization", "key=" & apiKEY.Text)
End Sub
' This is sending message
'SendMessage("general", "Dear User ", "good morning")
' This is not sending message??? what can be the issue
SendMessage(txtTopic.Text, txtTitle.Text, txtMessage.Text)
'log flashes message id, but it is not pushed.
please help
Attachments
Last edited: