Baseflow / XamarinMediaManager

Cross platform Xamarin plugin to play and control Audio and Video
https://baseflow.com
MIT License
761 stars 304 forks source link

Update MediaBrowserService.cs #895

Closed BajakiGabesz closed 1 year ago

BajakiGabesz commented 1 year ago

:sparkles: What kind of change does this PR introduce? (Bug fix, feature, docs update...)

It is a bugfix related to Android MediaBrowserService which causes an instant crash when starting the foreground process on Android Pie and maybe others too.

:arrow_heading_down: What is the current behavior?

The application crashes as soon as trying to create a notification on some systems.

:new: What is the new behavior (if this is a feature change)?

We don't use ForegroundService.TypeMediaPlayback when starting foreground service as it may not be known by earlier operating systems like Android Pie.

:boom: Does this PR introduce a breaking change?

No.

:bug: Recommendations for testing

894

:memo: Links to relevant issues/docs

-

:thinking: Checklist before submitting

martijn00 commented 1 year ago

@BajakiGabesz thanks. Do you have a clue about: https://github.com/Baseflow/XamarinMediaManager/blob/develop/MediaManager/Platforms/Android/MediaSession/MediaBrowserService.cs#L17

Does ForegroundServiceType = ForegroundService.TypeMediaPlayback work on older devices as well?

BajakiGabesz commented 1 year ago

@BajakiGabesz thanks. Do you have a clue about: https://github.com/Baseflow/XamarinMediaManager/blob/develop/MediaManager/Platforms/Android/MediaSession/MediaBrowserService.cs#L17

Does ForegroundServiceType = ForegroundService.TypeMediaPlayback work on older devices as well?

@martijn00 that one was not causing any issues on my physical device, only that line does which I just modified.

I just checked it in multiple emulators for now from API 28 to API 30 and everything works fine. I only have API 31 and API 28 physical devices.