0

I read in many places that if user swipes up and kills an app, that app will not be able to receive location updates. I get didEnterRegion and didExitRegion callbacks are received when my app is not killed and is in background. But if I swipe kill app, app doesn't get those callbacks. My question here is,

  1. Is it that app will stop getting callbacks ever? i.e., even if the app is launched again and is in background it does not get the callbacks
  2. I read about startMonitoringSignificantLocationChanges and background app refresh when used together, I can get callback even when app is killed by swipe. I tried this and could not get it working. Is this the expected behavior?
  3. Will startMonitoringSignificantLocationChanges and background app refresh together when used, I get region entry/exit callbacks after rebooting device?
Vinuta
  • 575
  • 4
  • 18

1 Answers1

0

This is not expected behavior. You are supposed to get didEnterRegion and didExitRegion callbacks even after killing an app in the task switcher. If you are not seeing this, something may be wrong with your app or testing methodology. Posting code may be helpful.

A few caveats and tips:

  • Make sure your app has obtained backround permission with locationManager.requestAlwaysAuthorization(). Without it, it cannot detect at all in the background.

  • Detection in the killed state did not work on iOS 7.0.x. It started working as of 7.1+.

  • Make sure you wait long enough to get detections. In some app states, it can take up to 15 minutes.

  • Before killing your app in testing, check logs to ensure you know what CoreLocation thinks is your current region state. If you turn off a beacon then kill your app, CoreLocation may not have had time to realize the beacon disappeared, thinking it is still inside the region. If you then turn on the beacon, you will not get a new entry event because it thinks you are already inside.

davidgyoung
  • 63,876
  • 14
  • 121
  • 204
  • Verified above mentioned points. No issues with any of these but yet I don't get background notifications only in case of swipe up and kill. I get the notifications in case of app in background and device reboot. – Vinuta Oct 20 '16 at 12:02
  • What do you think abt ZHr's comment on http://stackoverflow.com/questions/18946881/background-location-services-not-working-in-ios-7/21966662#21966662 – Vinuta Oct 20 '16 at 12:04
  • Also can you please confirm that startMonitoringSignificantLocationChanges and app background refresh are required or not to get didEntry/exit callbacks? – Vinuta Oct 20 '16 at 12:06