Skip to content

[BUG] Android 14+ Notification Body Tap Does Nothing #2976

@justcoding121

Description

@justcoding121

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

On Android 14+ tapping the notification body (title/artwork area) of a MediaStyle notification does nothing - no response at all. The tap is completely ignored.

Test Results:

  • Pixel 7a (Android 15): Notification body tap → No response (does nothing)
  • Samsung Galaxy S10+ (Android 12): Notification body tap → Works correctly on lock screen (opens app), but does nothing on unlocked sticky notification

What Still Works:

  • Play/Pause button on notification → Works correctly
  • Next/Previous buttons on notification → Work correctly
  • Media controls function normally

What Doesn't Work:

  • Notification body tap on Pixel 7a → Completely ignored, no response

Expected Behavior

When a user taps the notification body (title/artwork area) of a MediaStyle notification, the app should:

  1. Open the app (bring it to foreground)
  2. Navigate to the appropriate screen (e.g., show alarm modal, episode details, etc.)
  3. This should work consistently across all Android versions (8-15) and all device manufacturers

Reference: This is the standard behavior on Android 8-13 and works on Samsung/Xiaomi devices even on Android 14+. Major apps like YouTube Music and Spotify handle this correctly.

Steps To Reproduce

  1. Create a .NET MAUI app using CommunityToolkit.Maui.MediaElement version 7.0.0
  2. Set up media playback with a MediaElement control
  3. Start playback (this creates a MediaStyle notification)
  4. Put the app in the background (or lock the screen)
  5. Tap the notification body (title or artwork area, NOT the play/pause button)
  6. Observed: On Pixel 7a (Android 15), the tap does nothing - no response
  7. Expected: App should open and navigate to the appropriate screen

Additional Test Steps:

  • Try setting SessionActivity via reflection → Notification body tap still does nothing
  • Try overriding notification with null MediaSession token → Notification body tap still does nothing
  • Try continuous notification override → Notification body tap still does nothing

Link to public reproduction project repository

...

Environment

- **Package**: `CommunityToolkit.Maui.MediaElement` version **7.0.0**
- **.NET Version**: .NET 10.0
- **MAUI Version**: 10.0.11
- **Platform**: Android
- **Android Version**: Android 14+ (API 34+)
- **Tested Devices**:
  - **Pixel 7a (Android 15)** - ❌ Body tap does nothing
  - **Samsung Galaxy S10+ (Android 12)** - ✅ Body tap works on lock screen
- **Android SDK**: 36 (Android 15)
- **Target Framework**: net10.0-android

Anything else?

Root Cause Analysis

According to Android's official documentation:

"When a MediaStyle notification is displayed with a MediaSession token, taps on the notification body are reserved for resuming the media session (i.e. they trigger MediaSession.Callback.onPlay()). The ContentIntent is ignored unless no MediaSession token is set."

The Problem:

  1. MediaElement 7.0.0 uses Media3 (androidx.media3.session.MediaSession)
  2. Media3's MediaSession callback is set during session creation via MediaSession.Builder.setCallback()
  3. MediaElement creates the MediaSession internally in MediaManager.android.cs (line 174-177) without exposing a way to set a custom callback
  4. Media3's MediaSession does not allow changing the callback after creation (it's immutable)
  5. The default callback's OnPlay() method just plays/pauses - it doesn't open the app
  6. On Pixel 7a, even setting MediaSession token to null in MediaStyle doesn't work - the system still ignores ContentIntent

Discussion

#2975

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions