How to dismiss a given notification with ADB on LineageOS 23.2 without simulating swiping it?
Oct 11, 1:00pm
Short answer: on LineageOS 23.2 (Android 16), there's no cmd notification subcommand to dismiss a specific notification — the AOSP shell interface for the notification service only offers things like allow_listener, set_dnd, post, list, get, snooze, unsnooze, set_bubbles, etc., with no remove/dismiss/cancel verb (NotificationShellCmd.java). LineageOS ships this code essentially unchanged. So you can't do it with a plain one-liner as the shell user; here are the realistic no-swipe options:
Each notification key looks like 0|com.example.app|123|null|<channel>, i.e. userId|pkg|id|tag. Note the package, the numeric id (and tag, often null).
Then invoke the cancelNotificationWithTag binder method against the notification service as root (the caller must be the posting app or the system, hence root):
The transaction number <N> differs per Android version/build, so read it from your device's INotificationManager.Stub (e.g. via the build's framework, or trial from the transaction list — it changes, so don't trust numbers posted online for other builds).
2. Root-free: use a notification-listener app and grant it via ADB
Install an app that exposes dismiss through NotificationListenerService (Tasker + AutoNotification, or a small custom NotificationListenerService app calling cancelNotification(key)).
The component name must be a full ComponentName; a bare package name fails with "Invalid listener" (Stack Overflow). Then trigger the dismiss from that app (e.g. Tasker's "Notification Cancel" action).
3. Crude root-free fallbacks (kill the notification at the source)
adb shell am force-stop <package> — removes all notifications posted by that app (also kills the app/process).
adb shell cmd notification set_dnd priority etc. — hides but doesn't dismiss.
Caveats: ongoing/foreground-service notifications can't be user-dismissed anyway; force-stop or root binder calls still remove them, but some system apps respawn the notification immediately.
Oct 11, 1:00pm
This is a shared conversation and may include unverified content that doesn't reflect Mistral AI's views. Login to resume chatting.