flutter_foreground_task
flutter_foreground_task copied to clipboard
Service not stopping when app exited
I do have android:stopWithTask="true" and I also try to call FlutterForegroundTask.stopService() both from the dispose() of my main page and its PopScope.onPopInvoked() handler (although the latter two don't really help with the usual Android app lifecycle) and quite often the service doesn't stop with the app itself. Although this manifest flag isn't terribly well documented, some online discussions suggest that in the case when you want to end the service with the app, you should call StopSelf() in the onTaskRemoved handler of the Android service. Did you maybe try this solution in the past and decided against it?