I need to do a application for send message similar to
https://www.b4x.com/android/forum/t...-messages-firebase-cloud-messaging-fcm.67716/
but in UI Application.
No error, but i suppose need to do: StartMessageLoop, catch JOBDONE and StopMessageLoop
but in UI i can't doit.
What i need to do?
https://www.b4x.com/android/forum/t...-messages-firebase-cloud-messaging-fcm.67716/
but in UI Application.
No error, but i suppose need to do: StartMessageLoop, catch JOBDONE and StopMessageLoop
B4X:
SendMessage(Subscripcion,Titulo,Cuerpo)
StartMessageLoop
B4X:
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=" & API_KEY)
End Sub
Sub JobDone(job As HttpJob)
Log(job)
If job.Success Then
Log(job.GetString)
End If
job.Release
StopMessageLoop '<-- non ui app only
End Sub
but in UI i can't doit.
What i need to do?