Hi,
I am beginning to use firebase notifications in my app and everything seems to be working.
The following code is what I am using to display the notification as it arrived:
Problem is that it shows and displays the notification sound while the app is open.
Is there a way to detect if the app is open or closed and only display and play the notification sound if the app is closed only?
I am beginning to use firebase notifications in my app and everything seems to be working.
The following code is what I am using to display the notification as it arrived:
B4X:
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
Problem is that it shows and displays the notification sound while the app is open.
Is there a way to detect if the app is open or closed and only display and play the notification sound if the app is closed only?