-
Notifications
You must be signed in to change notification settings - Fork 10
Description
When using background_location_2 on Android, the foreground service (BackgroundLocationService) continues running even after the app is closed or removed from the "Recents" / Task Manager.
I already added android:stopWithTask="true" to the entry in AndroidManifest.xml (inside ).
I also tried calling BackgroundLocation.stopLocationService() in Flutter (dispose, detached, onWillPop).
The method gets called, but if the app is swiped away, Flutter is already detached and I see a NullPointerException in the logs. The notification stays visible and the service keeps running.
Logs
I/flutter: 🛑 GPS-Service über detached gestoppt
E/MethodChannel#com.almoullim.background_location/methods: java.lang.NullPointerException
at com.almoullim.background_location.BackgroundLocationService.stopLocationService(BackgroundLocationService.kt:149)
...
W/FlutterJNI: Tried to send a platform message response, but FlutterJNI was detached
Expected behavior
The foreground service should automatically stop when the app is closed or swiped away (like other location plugins).