LocationEngine
public class LocationEngine : LocationEngineBase
This class handles location updates received according to the desired LocationAccuracy. Each instance of this class will be using internally the same client providing the actual location updates. For that reason, only one LocationEngine can be started at a time. Multiple delegates can be attached, either to receive location updates, see LocationUpdateDelegate, or status updates, see LocationStatusDelegate. When a different LocationAccuracy is desired, the LocationEngine needs to be stopped and started again.
-
Declaration
Swift
public private(set) var isStarted: Bool { get } -
Undocumented
Declaration
Swift
public convenience init() throws -
Undocumented
Declaration
Swift
public init(sdkEngine: SDKNativeEngine) throws -
Starts the location engine with desired LocationAccuracy.
Declaration
Swift
public func start(locationAccuracy: LocationAccuracy) -> LocationEngineStatusParameters
locationAccuracyDetermines desired location accuracy.
Return Value
Location engine status.
-
Starts the location engine with desired LocationOptions. This method variant is not currently supported on iOS platforms.
Declaration
Swift
public func start(locationOptions: LocationOptions) -> LocationEngineStatusParameters
locationOptionsDetermines desired location options.
Return Value
LocationEngineStatus.notSupported.
-
Reconfigures the location engine with desired LocationAccuracy. This method is a faster way to change location accuracy for already started location engine, than calling
stop(...)andstart(LocationOptions)in sequence. ReturnsLocationEngineStatus.notReady, if called for unstarted location engine.Declaration
Swift
public func updateLocationAccuracy(locationAccuracy: LocationAccuracy) -> LocationEngineStatusParameters
locationAccuracyDesired location accuracy. Requested accuracy is not guaranteed.
Return Value
Engine status. Valid values are defined in
LocationEngineStatus -
Reconfigures the location engine with desired LocationOptions. This method is a faster way to change location options for already started location engine, than calling
stop(...)andstart(LocationOptions)in sequence. ReturnsLocationEngineStatus.notReady, if called for unstarted location engine. This method variant is not currently supported on iOS platforms. ReturnsLocationEngineStatus.notSupportedon platforms which this method variant is not supported.Declaration
Swift
public func updateLocationOptions(locationOptions: LocationOptions) -> LocationEngineStatusParameters
locationOptionsDesired location options.
Return Value
Engine status. Valid values are defined in
LocationEngineStatus -
Returns the last known location obtained by the engine. Location is returned synchronously. Location object has timestamp attribute, which reflects when data was obtained. If location was never obtained - nil is returned.
Declaration
Swift
public var lastKnownLocation: Location? { get } -
Stops the location engine.
Declaration
Swift
public func stop() -
This method does nothing on iOS platforms. Returns
ConfirmationStatus.okon this platform.Declaration
Swift
public func confirmHEREPrivacyNoticeInclusion() -> ConfirmationStatus -
This method does nothing on iOS platforms. Returns
ConfirmationStatus.okon this platform.Declaration
Swift
public func confirmHEREPrivacyNoticeException() -> ConfirmationStatus -
Adds a LocationDelegate to the engine to get notified when there is a new location update available. Supports more than one delegate, instance is added only once.
Declaration
Swift
public func addLocationDelegate(locationDelegate: LocationDelegate) -
Removes a LocationDelegate from the engine.
Declaration
Swift
public func removeLocationDelegate(locationDelegate: LocationDelegate) -
Declaration
Swift
public func addLocationStatusDelegate(locationStatusDelegate: LocationStatusDelegate) -
Declaration
Swift
public func removeLocationStatusDelegate(locationStatusDelegate: LocationStatusDelegate) -
Enables or disables application’s background location updates. By default background location updates are enabled if application has background location capabilities.
Declaration
Swift
public func setBackgroundLocationAllowed(allowed: Bool) -> LocationEngineStatusParameters
allowedSet to true to allow background location updates, or false to disable them.
Return Value
LocationEngineStatus.okif call succeeds.LocationEngineStatus.notAllowedif the application does not have background location capabilities enabled.LocationEngineStatus.notSupportedon platforms which do not support controlling of background location modes. -
Check if application’s background location updates are enabled. Returns false on platforms which do not support controlling of background location modes using
LocationEngineBase.setBackgroundLocationAllowed(...)method.Declaration
Swift
public func getBackgroundLocationAllowed() -> BoolReturn Value
True if background location updates are allowed, false otherwise.
-
Controls visibility of application’s background location indicator. By default background location indicator is visible, if application has background location capabilities.
Declaration
Swift
public func setBackgroundLocationIndicatorVisible(visible: Bool) -> LocationEngineStatusParameters
visibleSet to true to show background location indicator, or false to hide it.
Return Value
LocationEngineStatus.okif call succeeds.LocationEngineStatus.notAllowedif the application does not have background location capabilities enabled.LocationEngineStatus.notSupportedon platforms which do not support controlling of background location indicator visibility. -
Check if application’s background location indicator is visible. Returns false on platforms which do not support controlling of background location indicator using
LocationEngineBase.setBackgroundLocationIndicatorVisible(...)method.Declaration
Swift
public func getBackgroundLocationIndicatorVisible() -> BoolReturn Value
True if background location indicator is visible, false otherwise.
-
Controls automatic pausing of location updates e.g. for improving device’s battery life at times when location data is unlikely to change. By default automatic pausing of location updates is allowed.
Declaration
Swift
public func setPauseLocationUpdatesAutomatically(allowed: Bool) -> LocationEngineStatusParameters
allowedSet to true to allow automatic pausing of location updates, or false to disable them.
Return Value
LocationEngineStatus.okif call succeeds.LocationEngineStatus.notSupportedon platforms which do not support automatic pausing of location updates. -
Check if automatic pausing of location updates are enabled. Returns false on platforms which do not support controlling of automatic pausing of location updates using
LocationEngineBase.setPauseLocationUpdatesAutomatically(...)method.Declaration
Swift
public func getPauseLocationUpdatesAutomatically() -> BoolReturn Value
True if automatic pausing of location updates is enabled, false otherwise.
-
Enables or disables forcing listener calls to originate from main thread. When disabled listener calls can originate from any thread.
Declaration
Swift
public func setCallListenerFromMainThreadEnabled(enabled: Bool)Parameters
enabledSet to true to force listener calls to be called from main thread.
-
Declaration
Swift
public func onLocationUpdated(_ position: Location) -
Declaration
Swift
public func onStatusChanged(locationEngineStatus: LocationEngineStatus) -
Declaration
Swift
public func onFeaturesNotAvailable(features: [LocationFeature])