Android Question Clear push notification when pressed

Almog

Active Member
Licensed User
Hello,

Recently, I've added FirebaseNotifications to my app
I noticed that noticed when the user click the (push) notification, the app opens, but the notification still exists, and it is needed to swipe it in order to remove it.

Does anybody know how to make the push notification disappear when the user clicks it (and then the app will open)?

Thanks in advance
 

Almog

Active Member
Licensed User
Add:
B4X:
Notification.AutoCancel = True
I now tried it, but when 'publishing' the notification, it didn't appear at all...
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.AutoCancel = True
    n.Notify(1)
End Sub
Do you know please what the problem is?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Do you know please what the problem is?
that you are not reading any documentation.

SetInfo should be the last command before notifiy
 
Upvote 0
Top