Skip to content

Commit 2855859

Browse files
committed
Update library readme
1 parent 804a177 commit 2855859

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

libraries/README.md

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,39 @@ libraries/
3030

3131
We're including the MediaElement 7.0.0 source code to fix the Android 14+ notification body tap bug directly in the source, eliminating the need for the 800ms timer workaround.
3232

33+
### Fixes Applied
34+
35+
#### ✅ Android 14+ Notification Body Tap Fix (Commit: 804a177)
36+
37+
**Problem**: On Android 14+ (especially Pixel 7a), tapping the notification body did not bring the app to foreground.
38+
39+
**Solution**: Implemented the recommended Android 14+ approach using `MediaSession.SetSessionActivity()`:
40+
41+
1. **MediaManager.android.cs**:
42+
- Added `SetSessionActivity()` call to set a PendingIntent that brings the app to foreground when notification body is tapped
43+
- Uses explicit Intent targeting MainActivity with `CLEAR_TOP | SINGLE_TOP` flags for 100% reliability
44+
- Stores the PendingIntent in a static property for fallback use
45+
- Added proper error handling with logging
46+
47+
2. **MediaControlsService.android.cs**:
48+
- Added fallback `SetContentIntent()` call using the stored PendingIntent from MediaManager
49+
- This bypasses view interception and ensures notification body taps work for Android 14+
50+
51+
**Key Implementation Details**:
52+
- Uses `Platform.CurrentActivity` (not `AppContext`) for creating the PendingIntent - this is critical for reliability
53+
- Uses `PendingIntentFlags.Immutable | PendingIntentFlags.UpdateCurrent` for proper intent handling
54+
- The fix follows Android's recommended approach for Android 14+ notification body taps
55+
56+
#### ✅ Removed Timer Workaround (Commit: d18747e)
57+
58+
Removed the 800ms timer workaround from `AndroidPlayerNotificationService.cs` that was continuously reapplying the notification ContentIntent. This hack is no longer needed with the proper fix in place.
59+
3360
### Next Steps
3461

35-
1. Add the project to the solution
36-
2. Reference it instead of the NuGet package
37-
3. Fix the notification bug in `Services/MediaControlsService.android.cs` or `Views/MediaManager.android.cs`
38-
4. Remove the 800ms timer workaround from `AndroidPlayerNotificationService.cs`
62+
1. Add the project to the solution
63+
2. Reference it instead of the NuGet package
64+
3. Fix the notification bug in `Services/MediaControlsService.android.cs` and `Views/MediaManager.android.cs`
65+
4. Remove the 800ms timer workaround from `AndroidPlayerNotificationService.cs`
3966

4067
### License
4168

0 commit comments

Comments
 (0)