Dev-hwang / flutter_foreground_task

This plugin is used to implement a foreground service on the Android platform.
https://pub.dev/packages/flutter_foreground_task
MIT License
140 stars 105 forks source link

Stop service as a remote process #197

Closed dmts17 closed 1 month ago

dmts17 commented 7 months ago

Hey guys, I needed the service to keep working even if the user closes the app or reboots the phone, so I set the service to "remote" as suggested in another issue by adding the following inside my AndroidManifest. <service android:name="com.pravera.flutter_foreground_task.service.ForegroundService" android:process=":remote"/> and it works perfectly for my needs, but I would like to be able to stop the service if the user logs out inside the app, and since it's running in a remote process FlutterForegroundTask.stopService() doesn't seem to do anything anymore (unless I were to call it from inside my Task handler. Is there a proper way to achieve this? I don't have a lot of knowledge when it comes to native code.

Dev-hwang commented 1 month ago

android:process=":remote" is not required.

This plugin already has the ability to automatically restart a service if it terminates abnormally.