ryanheise / audio_service

Flutter plugin to play audio in the background while the screen is off.
805 stars 480 forks source link

Fixing issue 994 ForegroundServiceStartNotAllowedException #1052

Closed JoseBarreto1 closed 11 months ago

JoseBarreto1 commented 11 months ago

Avoiding ForegroundServiceStartNotAllowedException when android Disable Foreground is set to true.

Open issue that my PR is fixing: https://github.com/ryanheise/audio_service/issues/994

Pre-launch Checklist

ryanheise commented 11 months ago

Foreground is necessary for background playback.

JoseBarreto1 commented 11 months ago

Right. However, by default the foreground is enabled, it is only optional for those who want to disable it. I tested my application with the foreground disabled and still had the same experience in the background. This way, this change will not affect any user who already uses the audio_service, this change only allows the foreground to be optionally disabled.

ryanheise commented 11 months ago

That doesn't address my point, though. If you are trying to solve the ForegroundServiceStartNotAllowedException, this is not the "correct" way to do it, because it violates the policies of the operating system. Even if you propose adding this as an option, Android does not consider it to be correct.

JoseBarreto1 commented 11 months ago

Sorry. But would you know what would affect my app if Android doesn't consider this correct?

ryanheise commented 11 months ago

The issue that you linked to has a discussion of everything we know.