How to dismiss a given notification with ADB on LineageOS 23.2?
Oct 11, 12:59pm
On LineageOS 23.2 (Android 16-based) there is no official ADB command to dismiss a specific posted notification — cmd notification only manages channels/listeners/DND and can post test notifications, not remove individual ones (Stack Overflow). So you have two practical routes:
1. No-root: UI automation
Expand the shade and swipe the notification away:
bash
adb shell cmd statusbar expand-notifications
# then swipe it away, e.g. left at its coordinates:
adb shell input swipe 540 300 0 300 300
adb shell cmd statusbar collapse
Find the notification's y-position with adb shell dumpsys notification --noredact | grep -A5 <package> or by counting records from dumpsys notification. This is the approach used by test scripts, since unrooted devices have no direct API (sromku, Stack Overflow).
2. Root (LineageOS with root enabled in Developer options)
bash
adb shell su -c 'service call notification 1'
service call notification 1 invokes the cancelAll-style transaction and clears all notifications for the calling context; it requires root on modern Android (Stack Overflow). Transaction codes vary between builds, so check adb shell su -c 'service list' output and the AOSP INotificationManager stub for your version if code 1 doesn't work.
Note: some notifications (ongoing/foreground service, system) can't be dismissed even this way — you'd instead block the app's channel with adb shell cmd notification channel controls or cmd appops set <pkg> POST_NOTIFICATION ignore.
Oct 11, 12:59pm
This is a shared conversation and may include unverified content that doesn't reflect Mistral AI's views. Login to resume chatting.