Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove all notifications from notification bar

I want to remove all cancelable notifications from status bar. I know how to remove my app notifications I have seen this post before, butI want to remove other apps notifications.

There is a "Clear" button in notifications in all android versions which clears all notifications with this flag: Notification.FLAG_AUTO_CANCEL

That means it's possible to cancel all notifications. But I haven't found any document about how to do that. Is there anybody guide me how to do that?

Thanks

like image 915
Milad Faridnia Avatar asked Feb 23 '15 05:02

Milad Faridnia


1 Answers

To remove all notifications:

Kotlin

val NM = getSystemService(AppCompatActivity.NOTIFICATION_SERVICE) as NotificationManager
NM.cancelAll()

Java

NotificationManager NM = getSystemService(AppCompatActivity.NOTIFICATION_SERVICE) 
NM.cancelAll()
like image 68
زياد Avatar answered Oct 07 '22 08:10

زياد