Android Question Notification icon doesn't disappear

mauro vicamini

Active Member
Licensed User
Longtime User
Hi everyone!
I've this problem: When I recive a Remote Notification I create the Notification like this in my pushService service:

B4X:
        If Not(n.IsInitialized) Then
            n.Initialize
        End If
        n.AutoCancel = True
        n.Icon = "icon"
        n.Sound = True
        n.Number = cNot
        n.OnGoingEvent = False
        n.SetInfo( "Requests", "There are " & cNot & " requests ", Notify)
        n.Notify(1)
(note: n is in the Process_Globals of pushService service, cNot is only a counter to show how may requests I've recived)
All works great and when I click on the icon in the notification bar it starts my application and the icon disappear. The problem is when I'm already in my application in an activity different from Notify and I click on the icon it doesn't desappears even if in the Activity_Resume I've this code:
B4X:
pushService.n.Cancel(1)

I've noted one thing: in the first case the notification is displayed outside the OnGoing section. In the second case it's displayed in the OnGoing section.

How can I cancel the icon from the notification bar in all conditions?

Thanks for the attention.
 
Top