Android Question Firebassing Messaging service behaviour mismatch in background/foreground

Yuls

Member
Licensed User
Longtime User
Hi, Erel.
I have tested the test app 'Pushexample' to receive messages through Firebase Messaging, following the updated tutorial of Firebasse Messaging and everything worked correctly in principle, receiving the notification both in the foreground and in the background. Then I modified the sub that receives the message to change the response way (Toastmessage instead of Notification ):
B4X:
Sub fm_MessageArrived (Message As RemoteMessage)
    Log("Message arrived")
    Log($"Message data: ${Message.GetData}"$)
    If B4XPages.IsInitialized And B4XPages.GetManager.IsForeground Then
        Log("App is in the foreground. In iOS a notification will not appear while the app is in the foreground (unless UserNotificationCenter is used).")
    End If
    ToastMessageShow (Message.GetData.Get("title"),True)
    'Dim n2 As Notification
    'n2.Initialize2(n2.IMPORTANCE_HIGH)
    'n2.Icon = "icon"
    'n2.SetInfo(Message.GetData.Get("title"), Message.GetData.Get("body"), Main)
    'n2.Notify(1)
End Sub
...and what happens now is that in the foreground it responds according to the changes made, but in the background it continues to make the notification as in the first version!? It does not change. Also clicking on the notification it does not show the main application.
I have even done tests on factory resetting the android phone, I used several android phones brands and Android versions. Same result.
Somebody can help me?
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…