This issue is android-only.
Using flutter plugin flutter_plugin_android_lifecycle we can register a listener for app destroy event.
When app gets destroyed, we want the foregroundservice to stop. Otherwise wenn we reopen the app, the plugin cannot connect to the running service and gets buggy.
This issue is android-only. Using flutter plugin flutter_plugin_android_lifecycle we can register a listener for app destroy event. When app gets destroyed, we want the foregroundservice to stop. Otherwise wenn we reopen the app, the plugin cannot connect to the running service and gets buggy.
We have to do this logic in platform-specific code, since _channel.invokeMethod wont work on flutter side when trying to call stop via WidgetsBindingObserver. See issue https://github.com/flutter/flutter/issues/65538 and related issue https://github.com/Sithira/FlutterRadioPlayer/issues/21.