Hello, while using Firebase Messaging I noticed that messages I send using code from the sample B4J app posted at https://www.b4x.com/android/forum/t...-messages-firebase-cloud-messaging-fcm.67716/ are delivered to my B4A mobile app but don't show up in the Firebase Cloud Messaging console.
I noted the warning on the console page:
So I tried to associate a label with the message's analytics data using fcm_options and
analytics_label but still it does not work so I'm not sure I'm doing it right.
Here's my code:
Can anyone check if this code sounds correct?
And if yes, do you have an idea why data messages do not show up in the Firebase console?
Thanks
Andrea
I noted the warning on the console page:
Starting Monday, July 1, 2019, you will be able to filter data by an analytics label.
Data messages sent without an analytics label might not be represented in this dashboard after that date.
So I tried to associate a label with the message's analytics data using fcm_options and
analytics_label but still it does not work so I'm not sure I'm doing it right.
Here's my code:
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}"$, "priority": "HIGH")
Dim data As Map = CreateMap("title": Title, "body": Body)
Dim fcm As String = $"{"analytics_label":"Testnotification"}"$
m.Put("data", data)
m.Put("fcm_options", fcm)
Dim jg As JSONGenerator
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
Can anyone check if this code sounds correct?
And if yes, do you have an idea why data messages do not show up in the Firebase console?
Thanks
Andrea