iOS seems to stop tracking when app is closed.
See original GitHub issueAndroid’s service runs properly and tracks position when the app is closed, but iOS only tracks the position when the app is in the background and not when it’s closed.
Environment
Plugin version 2.2.5 Cordova CLI: 6.5.0 Ionic Framework Version: 2.2.0 Ionic CLI Version: 2.2.2 Ionic App Lib Version: 2.2.1 Ionic App Scripts Version: 1.1.4 ios-deploy version: 1.9.1 ios-sim version: 5.0.8 OS: macOS Sierra Node Version: v4.4.3 Xcode version: Xcode 8.3.2 Build version 8E2002
Context
In iOS, when closing the app, all tracking stops. Most of the time, I am in stationary mode, but even if I go in the emulator and fake movement, it’s not tracked if the app is closed. However, it works as expected when the app is in background.
Config
const config: BackgroundGeolocationConfig = { desiredAccuracy: 0, stationaryRadius: 4, distanceFilter: 4, syncThreshold: 1, maxLocations: 25, startOnBoot: true, saveBatteryOnBackground: false, //ios startForeground: true, debug: true, // enable this hear sounds for background-geolocation life-cycle. pauseLocationUpdates: false, //Pauses location updates when app is paused (default: true) stopOnTerminate: false, // enable this to clear background location settings when the app terminates httpHeaders: { 'Authorization': this.config.getApiKey() }, url: this.config.url + '/positions' }
Expected Behavior
Like Android, I was thinking that it would send position updates when moving or changing position. But it doesn’t seem to work at all when the app is closed.
Actual Behavior
Nothing seems to be happening in the background, so I’m wondering if this is just because the service is killed and will never come back or if it will come back on it’s own later… not sure how it works yet.
Possible Fix
Unsure yet since I don’t understand if this is normal behavior or not.
Steps to Reproduce
- Install on iOS
- Start app (position gets tracked)
- Double tap home
- Emulator Debug City Run (position gets tracked)
- Close app
- Emulator Debug City Run (position doesn’t get tracked)
- Emulator Debug Freeway Drive (position doesn’t get tracked)
- Whatever I do, no more updates from that point on…
Context
We are using this plugin in order to match people and we don’t want to force users to come back in the app regularly just to update their position so we take very inaccurate regular positions in order to know if they are still available to match in their respective radius.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7
Top GitHub Comments
Me too. gonna move to
Cordova-background-geolocation-lt
— no support here.basically this plugin doesn’t work on ios when the app closes it just silently crashes, no logs no notification… Impossible for me to debug, so I’m moving on. Cordova-background-geolocation-lt works from the first try with the same configurations.