Not sure what I am doing wrong here. Message has both a subject and a body. Message was created in the Firebase console.
Log:
B4X:
Sub fm_MessageArrived (Message As RemoteMessage)
Log("DEBUG")
Log("Message arrived")
Log("From: " & Message.From)
Log("ID : " & Message.MessageId)
Log("Message: " & Message)
Log("Time: " & DateTime.Time(Message.SentTime))
''Log($"Message data: ID ${Message.MessageId}, Data ${Message.GetData}"$)
Dim MMap As Map = Message.GetData
''MMap.Initialize
Log("mMap.Size = " & MMap.Size)
''map = CreateMap("body1":Message.GetData,"title1":Message.GetData)
For Each key As String In MMap.Keys
Log("key = " & key)
Dim value As Int = MMap.Get(key)
Log("value = " & value)
Next
' 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
Log:
B4X:
** Receiver (firebasemessaging) OnReceive **
** Service (firebasemessaging) Start **
FirebaseMessaging - Service_Start
DEBUG
Message arrived
From: /topics/general
ID : 0:1647889xxxxxx30822%fd0xxxxxxxxxxxx575 ' edited for this post
Message: (RemoteMessage) com.google.firebase.messaging.RemoteMessage@65d922b
Time: 12:09:35
mMap.Size = 0 <---------------------------------------------------
** Activity (main) Pause event (activity is not paused). **
** Service (starter) Destroy (ignored)**
Last edited: