[notification] Android: every notification gets an empty InboxStyle, hiding the body

Open Beginner friendly
#3,770 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 3 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
android, kotlin, rust

Research direction

Start by tracing how NotificationData.inbox_lines is serialized from Rust and how TauriNotificationManager.buildNotification applies InboxStyle in Kotlin. Compare the two suggested fixes and check the existing notification tests or add a regression case for a title-and-body notification. Done means the expanded Android notification shows its body without requiring large_body.

Written by the indexing model from the issue text.

Description

Describe the bug

On Android, a notification built with only a title and body shows no body text when expanded:

app.notification().builder().title("Claude Bot").body("Hello").show()?;

adb shell dumpsys notification --noredact shows the notification was posted with an empty InboxStyle:

android.title=String (Claude Bot)
android.textLines=CharSequence[] (0)

On Samsung One UI the notification is shown expanded by default, so the message text is never visible.

Cause

NotificationData.inbox_lines is a Vec<String> with #[serde(default)] and no skip_serializing_if, so every notification is sent to Kotlin with "inboxLines": []. Notification.inboxLines is List<String>?, and TauriNotificationManager.buildNotification applies InboxStyle whenever inboxLines != null. An empty list is not null, so every notification without largeBody gets an InboxStyle with zero lines, which replaces the body in the expanded view.

Reproduction
  1. On Android, show a notification with only title and body set.
  2. Expand it (or view it on One UI): only the title is visible.
  3. adb shell dumpsys notification --noredact lists android.textLines=CharSequence[] (0).
Expected behavior

The body text is visible in the expanded notification.

Suggested fix

Either #[serde(skip_serializing_if = "Vec::is_empty")] on inbox_lines, or !notification.inboxLines.isNullOrEmpty() in buildNotification.

Workaround: also set large_body to the body text. BigTextStyle is checked before InboxStyle.

Platform and versions
  • tauri-plugin-notification 2.3.3; the same code is on the current default branch (2.8.0)
  • Android, Samsung One UI
Dominant language
Rust
Stars
1.8k
Forks
637
Avg merge
5d 3h
Merged PRs (30d)
36

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from tauri-apps/plugins-workspace

All issues in tauri-apps/plugins-workspace

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.