Good morning forum,
If i do the following procedure, i have a problem with notification and B4XPages initilization.
1) I open my app and click back button in order to exit app
2) I clear recent apps
3) When i send a notification and clicking it, log stops there:
App is shown to be loaded but nothing loaded, just a black screen. Nothing from B4XPages loaded. I initialize nothing on starter service.
I can reproduce this behavior on Pixel 7 Pro (SDK 34). On an older smartphone, everything works fine.
p.s. It had been asked here too
If i do the following procedure, i have a problem with notification and B4XPages initilization.
1) I open my app and click back button in order to exit app
2) I clear recent apps
3) When i send a notification and clicking it, log stops there:
B4X:
*** Receiver (firebasemessaging) Receive (first time) ***
Message arrived
Message data: {chatMessageID=d2dac0b7-263b-af8a-837c-4392e617fc75, chatID=132c703f-6f34-11ee-a7a2-52894e2c9ee7, typeNotification=chat, userTo=169097122283136, userSent=2dcc00c6-4da4-11ee-a7fa-52894e2c9ee7, body=S, title=ΕΠΩΝΥΜΟ ΟΝΟΜΑ}
** Service (starter) Start **
B4X:
Sub Activity_Resume
B4XPages.Delegate.Activity_Resume
Dim in As Intent
in = Activity.GetStartingIntent
If in.HasExtra("Notification_Tag") Then
Log(in.GetExtra("Notification_Tag")) 'Will log the tag
Dim jp As JSONParser
jp.Initialize(in.GetExtra("Notification_Tag"))
Dim root As Map = jp.NextObject
Dim typeNotification As String = root.Get("typeNotification")
Select typeNotification
Case "changeSubNember"
B4XPages.MainPage.tabMenu_TabClick(1)
Case "chat"
Dim userSent As String = root.Get("userSent")
B4XPages.ShowPage("chatPage")
B4XPages.MainPage.chatPage.getChat(userSent)
End Select
End If
End Sub
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
Dim jgen As JSONGenerator
jgen.Initialize(mapParameters)
If B4XPages.IsInitialized Then
If B4XPages.GetManager.GetTopPage.Title.As(String)=Message.GetData.Get("chatID").As(String) Then
B4XPages.MainPage.chatPage.getLastChatMessage(Message.GetData.Get("chatMessageID"))
Else
Dim n As Notification
n.Initialize2(n.IMPORTANCE_HIGH)
n.AutoCancel=True
n.Icon = "icon"
' n.Number=1
n.SetInfo2(Message.GetData.Get("title"), Message.GetData.Get("body"), jgen.ToString,Main)
n.Notify(1)
End If
Else
Dim n As Notification
n.Initialize2(n.IMPORTANCE_HIGH)
n.AutoCancel=True
n.Icon = "icon"
n.Number=1
n.SetInfo2(Message.GetData.Get("title"), Message.GetData.Get("body"), jgen.ToString,Main)
n.Notify(1)
End If
End Sub
I can reproduce this behavior on Pixel 7 Pro (SDK 34). On an older smartphone, everything works fine.
p.s. It had been asked here too
Last edited: