-
Notifications
You must be signed in to change notification settings - Fork 468
Description
Is there an existing issue for this?
- I have searched the existing issues
Did you read the "Reporting a bug" section on Contributing file?
- I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug
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:
- Open the app (bring it to foreground)
- Navigate to the appropriate screen (e.g., show alarm modal, episode details, etc.)
- 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
- Create a .NET MAUI app using
CommunityToolkit.Maui.MediaElementversion 7.0.0 - Set up media playback with a
MediaElementcontrol - Start playback (this creates a MediaStyle notification)
- Put the app in the background (or lock the screen)
- Tap the notification body (title or artwork area, NOT the play/pause button)
- Observed: On Pixel 7a (Android 15), the tap does nothing - no response
- Expected: App should open and navigate to the appropriate screen
Additional Test Steps:
- Try setting
SessionActivityvia 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-androidAnything 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()). TheContentIntentis ignored unless no MediaSession token is set."
The Problem:
- MediaElement 7.0.0 uses Media3 (
androidx.media3.session.MediaSession) - Media3's
MediaSessioncallback is set during session creation viaMediaSession.Builder.setCallback() - MediaElement creates the
MediaSessioninternally inMediaManager.android.cs(line 174-177) without exposing a way to set a custom callback - Media3's
MediaSessiondoes not allow changing the callback after creation (it's immutable) - The default callback's
OnPlay()method just plays/pauses - it doesn't open the app - On Pixel 7a, even setting MediaSession token to null in MediaStyle doesn't work - the system still ignores ContentIntent