Built-in location engines

VERSION 0.2.1455
PUBLIC PREVIEW

The Location module contains a LocationEngine interface that provides location updates to other modules of the Maps and Navigation SDKs. Those modules can subscribe to continue to receive location updates. You can also implement your own LocationEngine. See the instructions in the Custom Location Engine guide.

The Location module provides a predefined set of location engines:

Learn how to set up a project and add these location engine dependencies in the Quickstart.

DefaultCLLocationEngine

The DefaultCLLocationEngine updates user locations using the Apple Core Location services. Under the hood, it uses the CLLocationManager class as a GPS source provider.

Accuracy is set to the highest possible level, which uses additional sensor data to facilitate navigation apps.

The minimum distance (expressed in meters) a device must move horizontally before an update event is generated is set to the kCLDistanceFilterNone value. This constant indicates that all movement should be reported.

The location engine requires CLAuthorizationStatus.authorizedAlways or CLAuthorizationStatus.authorizedWhenInUse permissions. DefaultCLLocationEngine has built-in authorization request and authorization status verification.

Creating the DefaultCLLocationEngine object does not require any parameters to be provided.

let defaultLocationEngine: LocationEngine = DefaultCLLocationEngine()

The DefaultCLLocationEngine provides the DefaultLocationValidator class for checking if the location is fixed or not. If you want to set a custom validator, you have to create the object which adopts the LocationValidator protocol and pass this object to the engine.

let validationPolicy: LocationUpdateValidationPolicy = validationPolicy
let defaultLocationEngine: LocationEngine = DefaultCLLocationEngine(locationValidationPolicy: validationPolicy)