Android Question Clear push notification when pressed

Discussion in 'Android Questions' started by Almog, Apr 15, 2019.

  1. Almog

    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
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Add:
    Code:
    Notification.AutoCancel = True
     
    José J. Aguilar likes this.
  3. Almog

    Almog Active Member Licensed User

    OK, Thank you :)
     
  4. Almog

    Almog Active Member Licensed User

    I now tried it, but when 'publishing' the notification, it didn't appear at all...
    Code:
    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?
     
  5. DonManfred

    DonManfred Expert Licensed User

    that you are not reading any documentation.

    SetInfo should be the last command before notifiy
     
  6. Almog

    Almog Active Member Licensed User

    OK, thank you
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice