How to clear notifications using the ADB shell

I know that I can unlock the screen, pull out notifications and click the "Clear notifications" button, but there should be a way to clear notifications via ADB , right? I suppose this is a bit of Intent sent via the am command, or maybe something even simpler, but I cannot find anything on the network. All I get is Java code for use with apk .

Edit: I should probably mention that I'm working on 4.3, sometimes commands may vary between versions.

+7
android shell adb android-notifications
source share
2 answers

Try:

 adb shell service call notification 1 
+7
source share

If you know the device type and version of Android, you can clear notifications using ADB without a root device.

The idea is to turn off notifications and delete all notifications one by one.

  • Pull down:

     adb shell input swipe 0 0 0 300 
  • Swipe past:

     adb shell input swipe 0 400 300 400 

It is important to note that (x, y) is something that depends on different types of devices and versions of Android. You will need to find some checks that x, y is best for you.

Full script

 adb shell input swipe 0 0 0 300 num=$(adb shell dumpsys notification | grep NotificationRecord | wc -l) echo $num while [ $num -gt 0 ]; do adb shell input swipe 0 400 300 400 num=$(( $num - 1 )) done 

More information can be found here: http://sromku.com/blog/android-adb-clear-notifications

+1
source share

All Articles