Hi, I've been experimenting with Firebase cloud messaging and I'm able to receive notifications on B4A, however with the following payload the notification on screen appears with both title and body null, I imagine it's because the method Message.GetData("title") reads informations only inside the object data.
Is there any way to access the properties title and body nested in the object notification?
{
"message":{
"token":"...",
"notification":{
"title":"Portugal vs. Denmark",
"body":"great match!"
},
"data" : {
"Nick" : "Mario",
"Room" : "PortugalVSDenmark"
}
}
}
this is the code I'm using when the message arrives
Is there any way to access the properties title and body nested in the object notification?
{
"message":{
"token":"...",
"notification":{
"title":"Portugal vs. Denmark",
"body":"great match!"
},
"data" : {
"Nick" : "Mario",
"Room" : "PortugalVSDenmark"
}
}
}
this is the code I'm using when the message arrives
B4X:
Sub fm_MessageArrived (Message As RemoteMessage)
Log("Message arrived")
Log($"Message data: ${Message.GetData}"$)
Dim n As Notification
n.Initialize
n.Icon = "icon"
n.SetInfo(Message.GetData.Get("title"), Message.GetData.Get("body"), Main)
n.Notify(1)
End Sub