Location Stops When the App is Backgrounded after some time.

I am working on an app that requires location to work in the background constantly. I am using CLLocationManager.

Whats happening is after sometime the location service stops working in the background. We have seen the location services stop with in 30 seconds of being in the background, as well as up to 20 hours of location working in the background then it stops. Usually the app doesn't crash, but at times we have seen a crash (very rarely).

Currently we:

  1. Enabled the background location in info.plist
  2. Requests always authorization
  3. Start location updates in the foreground
  4. allowsBackgroundLocationUpdates is set to true
  5. pausesLocationUpdatesAutomatically is set to false.
  6. when a car is detected the desired accuracy is set to kCLLocationAccuracyBestForNavigation

Any help would be great.

Replies

I'm observing the same thing on an iPhone XS Max running iOS 16.1 (beta 4). I've checked many times the configuration of my app and of the CLLocationManager. It should always receive updates but sometimes, it stops. When I put the app back into foreground, the updates are received again (the app was not killed). I've not found any pattern: sometimes it happens after 5 minutes, sometimes half an hour or more. It's happening with Low Power Mode enabled and disabled.

Have you found a solution?