question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

iOS seems to stop tracking when app is closed.

See original GitHub issue

Android’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

  1. Install on iOS
  2. Start app (position gets tracked)
  3. Double tap home
  4. Emulator Debug City Run (position gets tracked)
  5. Close app
  6. Emulator Debug City Run (position doesn’t get tracked)
  7. Emulator Debug Freeway Drive (position doesn’t get tracked)
  8. 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:closed
  • Created 6 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
iBasitcommented, May 10, 2017

Me too. gonna move to Cordova-background-geolocation-lt — no support here.

0reactions
epetrecommented, May 3, 2017

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Control app tracking permissions on iPhone - Apple Support
Go to Settings > Privacy & Security > Tracking. The list shows the apps that requested permission to track you. · To stop...
Read more >
How to Stop Individual App Tracking on iPhone - MakeUseOf
Go to the Settings app. Scroll down to the app that you'd like to disable tracking for. Tap on the app. Find the...
Read more >
Stop iPhone Apps From Tracking You With This Settings ...
Under Settings, tap an app, and then tap to turn off Allow Tracking. Or go to Settings > Privacy > Tracking, and tap...
Read more >
Location services don't stop when application is terminated
The reason that the location service doesn't stop when you ask it to is not because you haven't stopped it or released it...
Read more >
How To Stop Apps Tracking You on iPhone and iPad - Macworld
Go to Settings > Privacy > Tracking. App Tracking ios 14.5 · Allow App to Request to Track will be turned off (the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found