Hi,
I implemented FCM in a app with success but when any activity is open the notification fields are null. If the app is in background, the notification shows correctly the title and message.
Any suggestion about what could be happening? The FirebaseMessaging (exactly this service name as indicated in tutorial ) service code is:
I implemented FCM in a app with success but when any activity is open the notification fields are null. If the app is in background, the notification shows correctly the title and message.
Any suggestion about what could be happening? The FirebaseMessaging (exactly this service name as indicated in tutorial ) service code is:
B4X:
#Region Service Attributes
#StartAtBoot: True
#End Region
Sub Process_Globals
Public fm As FirebaseMessaging
End Sub
Sub Service_Create
fm.Initialize("fm")
fm.SubscribeToTopic("general")
End Sub
Public Sub SubscribeToTopics
fm.SubscribeToTopic("general") 'you can subscribe to more topics
End Sub
Sub Service_Start (StartingIntent As Intent)
If StartingIntent.IsInitialized And fm.HandleIntent(StartingIntent) Then Return
End Sub
Sub fm_MessageArrived (Message As RemoteMessage)
Log("Message arrived")
Log($"Message data: ${Message.GetData}"$)
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
Sub Service_Destroy
End Sub