I followed (some time ago) the @Erel related tutorial (FirebaseNotifications) and I have successfully implemented the FCM within my App.
I can send some test notifications using the Firebase console.
My question is:
Is there the possibility to implement an Android / Java App that allow a user to send notifications instead of using the firebase console ?
If I understood well I can implement the "sender" App starting from this code ?
Thanks in advance for your reply
I can send some test notifications using the Firebase console.
My question is:
Is there the possibility to implement an Android / Java App that allow a user to send notifications instead of using the firebase console ?
If I understood well I can implement the "sender" App starting from this code ?
B4X:
Private Sub SendMessage (Topic AsString, Title AsString, Body AsString)
Dim Job AsHttpJob
Job.Initialize("fcm", Me)
Dim m AsMap = CreateMap("to": $"/topics/${Topic}"$)
Dim data AsMap = CreateMap("title": Title, "body": Body)
m.Put("data", data)
Dim jg AsJSONGenerator
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
Sub JobDone(job AsHttpJob)
Log(job)
If job.Success Then
Log(job.GetString)
End If
job.Release
End Sub
Thanks in advance for your reply