If a new message arrived, I want to download some data from the server. this is allwais done, when the App starts. But if it is allready started, I set b_NewMsgArrived = True. Then the server also will be visited.
Code in the FirebaseMessaging:
Code in Main:
But if the app is in the backround (the phone is turned off), it does not work. I get the notification, that new message is arrived. This means, that fm_MessageArrived is fired, right? But b_NewMsgArrived is never true. It is hard to debug, because the firebase notificatin olny works in release mode. Any suggestions?
Code in the FirebaseMessaging:
B4X:
Sub fm_MessageArrived (Message As RemoteMessage)
Starter.b_NewMsgArrived = True
NewMessage(Message.GetData.Get("title"), Message.GetData.Get("body"))
Log("Message arrived")
Log($"Message data: ${Message.GetData}"$)
End Sub
Code in Main:
B4X:
Sub Activity_Resume
If Starter.b_NewMsgArrived = True Then GetNews(True)
End Sub
Last edited: