I need to cancel the notification of my application when my application terminates (when it is removed from the taskmanager). To clear the notification I wrote this method.
public void deleteNotification(){
NotificationManager notifManager = (NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
notifManager.cancelAll();
}
I put it in OnDestroy but the notification remains active and is not extinguished. I know that Android is not always immediately brings the event, how can I do? thank you in advance