Commit 440e4e2
Enhance service lifecycle and exit strategy (#2039)
* Enhance service lifecycle and exit strategy
- Updated `AndroidManifest.xml` to improve `CommunityToolkit.Maui.Media.Services` behavior. Added `android:stopWithTask=true` and `android:foregroundServiceType=mediaPlayback` attributes to ensure the service stops with the task and properly manages media playback in the foreground.
- Added `OnDestroy()` method in `MediaControlsService.android.cs` for a more aggressive shutdown approach. This includes logging service destruction, stopping and removing the service from the foreground, finishing and removing the task, exiting the application, and ensuring base class cleanup with `base.OnDestroy()`. This aims at a cleaner exit and resource management when the service is destroyed.
* Fix Merge error
---------
Co-authored-by: Brandon Minnick <[email protected]>
Co-authored-by: Gerald Versluis <[email protected]>1 parent 816e8a7 commit 440e4e2
File tree
2 files changed
+10
-1
lines changed- samples/CommunityToolkit.Maui.Sample/Platforms/Android
- src/CommunityToolkit.Maui.MediaElement/Services
2 files changed
+10
-1
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
220 | 229 | | |
221 | 230 | | |
222 | 231 | | |
| |||
0 commit comments