📚 Encyclopedia

Android · updated 2026-10-13

Android notifications and PendingIntent pitfalls

androidnotificationspendingintentchannelsmessagingstyle

Messaging-app notifications fail in ways that only show up in the field: a tap opens the wrong conversation, old read messages reappear, a hidden thread leaks its sender. Most causes trace back to a few Android behaviors that are easy to forget.

Wrong-conversation taps: filterEquals ignores extras

Two PendingIntents are "the same" if their Intents are filterEquals-equal (action, data, type, class, categories) and the request code matches. Extras are ignored. Tap intents that differed only by a thread_id extra collapsed into one record, and FLAG_UPDATE_CURRENT let the newest notification rewrite the target of older ones. Fix (the AOSP technique): put a unique data URI such as message://thread/<id> on every tap and action intent.

Side effect: a broadcast matched by a manifest <intent-filter> with no <data> element stops matching once it carries a data URI. Set an explicit component (setClass) as well.

Keep one authority for ids and policy

Stale history in MessagingStyle

Rebuilding the style from "the last 6 messages" re-posts already-read messages, including your own replies, on the next arrival. Build history from unread incoming messages plus your own messages newer than the newest unread. Add a setDeleteIntent that records a dismissal watermark (the newest rendered message timestamp) so a swiped-away notification does not resurrect. Dismissing a group summary may fire the children's delete intents; verify on the OEM.

Channels

Inline reply

Gotchas

See also

Linked from

Sources: message memory (notification_overhaul, notification_audit_2026_08, project_bugs_fixed), Message app v2.9.7 to v2.30.0, tldr post #1539