Hi
I can implement Firebase push notification in B4a and B4i successfully and there is no problem
I use below code for send notification
Dim Job As HttpJob
Job.Initialize("fcm", Me)
Dim m As Map = CreateMap("to": $"/topics/${Topic}"$)
Dim data As Map = CreateMap("title": "https://google.com", "body": Body , "type":"link")
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)
This code is working for B4i and B4a
In B4a there is no problem in Background and Foreground app and my app receive message in all state
But in B4i when i go to background,my app dont receive message
I searched about receive message in background and i understood i have to use "notification" tag in data
Example :
Dim Job As HttpJob
Job.Initialize("fcm", Me)
Dim m As Map = CreateMap("to": $"/topics/${Topic}"$)
Dim data As Map = CreateMap("title": "https://google.com", "body": Body , "type":"link")
m.Put("data": data)
m.Put("notification": 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)
When i add notification tag and send push,My app (in B4i) receive message in background
But there is issue about B4a
When i use notification tag in data,In android,when i go to background,My app can receive message but it only show firebase's notification and dont raise fm_MessageArrived event
Why?
I need send message for all device (android,ios) with one code
Thanks