B4J Question Test firebase B4J_FCM_PUSH can't run.

Åke Johansson Bravida

Member
Licensed User
I can´t run B4J FCM_Push code to test firebase.
I gott error on this line m.Put("data": data)
Logg error ','expected.
Unused variable 'data'.(warning #9)

I use B4J Ver: 7.32

How can I solve this?

Thank you very much for your help.

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
 
Last edited:
Top