Contents

Accessing the device’s location efficiently

Use Core Location features to manage energy use, receive updates, and minimize location update frequency.

Overview

Discovering a person’s location — particularly to a high desiredAccuracy — requires combining information from multiple device subsystems that each consume power while they’re active. Minimize the frequency with which your app requests location updates, and don’t leave location updates running when your app doesn’t need them.

Use CLLocationUpdate to receive updates from the system when the device’s location changes. If the device becomes stationary, Core Location sets the stationary flag and stops providing updates until the device moves again. When this happens, if you don’t expect movement again soon, consider stopping location updates and using CLMonitor to get notified of significant changes to the device’s location. Set distanceFilter to the distance the device needs to move before the system notifies your app.

If you need to receive location updates when your app is in the background, use CLBackgroundActivitySession, or call requestAlwaysAuthorization(). For more information, see Handling location updates in the background. However, only register for background location updates if your app’s functionality doesn’t work without it, as background updates increase your app’s energy use.

See Also

Networking and location