Hello
The message is recovered only when the app is open, then the message from b4j is not recovered, but what I wrote here:
This is what I see when the app is closed and immediately after sending the message.
Logger connesso a: HUAWEI BLN-L21
--------- beginning of crash
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
*** Service (firebasemessaging) Create ***
** Service (firebasemessaging) Start **
** Activity (main) Pause, UserClosed = false **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
*** Service (firebasemessaging) Create ***
** Service (firebasemessaging) Start **
When the app opens the log is this:
** Receiver (firebasemessaging) OnReceive **
** Service (firebasemessaging) Start **
Message arrived
Message data: ID 0:1531863143300168%959093b8959084b9, Data {}
Message=(RemoteMessage) com.google.firebase.messaging.RemoteMessage@1968a33
map=(MyMap) {title=Test1, body=Test2}
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
XTRA={"title":"Test1","body":"Test2"}
in=(Intent) Intent { flg=0x10020000 cmp=com.mio.read/.main (has extras) }
in ExtrasToString=Bundle[{Notification_Tag={"title":"Test1","body":"Test2"}}]
thank you
The message is recovered only when the app is open, then the message from b4j is not recovered, but what I wrote here:
B4X:
Dim map As Map :map.Initialize
map = CreateMap("title":"Test1", "body":"Test2")
This is what I see when the app is closed and immediately after sending the message.
Logger connesso a: HUAWEI BLN-L21
--------- beginning of crash
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
*** Service (firebasemessaging) Create ***
** Service (firebasemessaging) Start **
** Activity (main) Pause, UserClosed = false **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
*** Service (firebasemessaging) Create ***
** Service (firebasemessaging) Start **
When the app opens the log is this:
** Receiver (firebasemessaging) OnReceive **
** Service (firebasemessaging) Start **
Message arrived
Message data: ID 0:1531863143300168%959093b8959084b9, Data {}
Message=(RemoteMessage) com.google.firebase.messaging.RemoteMessage@1968a33
map=(MyMap) {title=Test1, body=Test2}
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
XTRA={"title":"Test1","body":"Test2"}
in=(Intent) Intent { flg=0x10020000 cmp=com.mio.read/.main (has extras) }
in ExtrasToString=Bundle[{Notification_Tag={"title":"Test1","body":"Test2"}}]
B4X:
Sub fm_MessageArrived (Message As RemoteMessage)
Log("Message arrived")
Log($"Message data: ID ${Message.MessageId}, Data ${Message.GetData}"$)
Log("Message="& Message)
Dim map As Map :map.Initialize
map = CreateMap("title":"Test1", "body":"Test2")
Log("map="&map)
Dim jgen As JSONGenerator
jgen.Initialize(map)
Dim n As NB6
mano = LoadBitmapResize(File.DirAssets, "mano.png", 24dip, 24dip, False)
n.Initialize("default", Application.LabelName, "DEFAULT").AutoCancel(True).SmallIcon(mano)
n.Build(Message.GetData.Get("title"), Message.GetData.Get("body"), jgen.ToString, Main).Notify(4)
End Sub
B4X:
Sub Activity_Resume
Dim in As Intent = Activity.GetStartingIntent
If in.IsInitialized And in <> OldIntent Then
OldIntent = in
Dim intentExtra As String
If in.HasExtra("Notification_Tag") Then
intentExtra = in.GetExtra("Notification_Tag")
Log("XTRA="&intentExtra)
Log("in="&in)
Log("in ExtrasToString="&in.ExtrasToString)
Dim jp As JSONParser
jp.Initialize(intentExtra)
Dim root As Map = jp.NextObject
Label4.Text = root.Get("title")
Label3.Text = root.Get("body")
End If
End If
End Sub
thank you