I formed Notification and set setAutoCancel (true) and when I click on Notification it disappears as expected.

But I have 2 addAction() buttons addAction() and when I click on them, the Notification does not disappear ...

Is it possible to put setAutoCancel(true) on the buttons? So after clicking on them, Notification was deleted?

    1 answer 1

    When you click on a button, the only thing that happens is that the associated PendginIntent is sent.

    Thus, by clicking on the notification button, you can hide it only where you accept the Intent started by the button. Those. there you need to remove the notification through NotificationManager

    • I thought so ... So if I set the id for Notification 0 like this mNotificationManager.notify (0, notification); then I have to delete it mNotificationManager.cansel(0) so? I just did it and it didn’t work out ... I need to figure it out - Aleksey Timoshchenko
    • @AlekseyTimoshchenko, yes, the principle is as follows - Yuriy Spb 6:43 pm