Reputation: 157
I know I can unlock the screen, pull down the notifications, and press the clear notifications button, but there's got to be a way to clear the notifications through ADB
, right? I'm guessing it's some Intent
sent through the 'am' command, or maybe something even simpler, but I can't seem to find anything on the net. All I'm getting is Java
code for use with an apk
.
Edit: I should probably mention that I'm running on 4.3, sometimes commands may vary between versions.
Upvotes: 7
Views: 14643
Reputation: 4683
If you know the type of the device and Android version, you can clear notifications using ADB without having rooted device.
The idea is to pull down notifications and swipe away all notifications one by one.
Pull down:
adb shell input swipe 0 0 0 300
Swipe away:
adb shell input swipe 0 400 300 400
It is important to mention, that the (x,y) is something that vary between different type of devices and Android versions. You will need to find by several checks what is the best x,y for you.
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 details can be found here: https://www.sromku.com/blog/android-adb-clear-notifications
Upvotes: 6