LocationEngine class
Handles location updates received according to the desired LocationAccuracy or LocationOptions.
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 listeners can be attached, either to receive location updates, see LocationListener, status updates, see LocationStatusListener or location issue has occurred, see LocationIssueListener]. When a different LocationAccuracy or LocationOptions is desired, the LocationEngine needs to be stopped and started again. Note: starting the LocationEngine with LocationOptions is only supported in Android platforms.
- Implemented types
Constructors
- LocationEngine()
- LocationEngine.withSdkEngine(SDKNativeEngine sdkEngine)
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isStarted → bool
-
Checks if the engine is in started state.
Checks if the engine is in started state.
no setteroverride
- lastKnownLocation → Location?
-
The last known location obtained by the engine.
Location is returned synchronously. Location object has a timestamp attribute,
which reflects when data was obtained. If location was never obtained - null is returned.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addLocationIssueListener(
LocationIssueListener listener) → void -
Adds a LocationIssueListener to the engine to get notified when a location issue has occurred
Supports more than one listener, instance is added only once.
override
-
addLocationListener(
LocationListener listener) → void -
Adds a LocationListener to the engine to get notified when there is a new location update available.
Supports more than one listener, instance is added only once.
override
-
addLocationStatusListener(
LocationStatusListener listener) → void -
Adds a LocationStatusListener to the engine to get notified when there is a an important status change.
Supports more than one listener, instance is added only once.
override
-
confirmHEREPrivacyNoticeException(
) → ConfirmationStatus -
On Android devices by calling this method, the application developer confirms that they have received an
exceptional permission from HERE in written form to not include a reference to the HERE
Privacy Notice. As a result, the
LocationEnginewill not collect characteristic information about the nearby mobile and Wi-Fi network signals. However, the engine will still be fully functional and will deliver location updates when the exception can be confirmed.override -
confirmHEREPrivacyNoticeInclusion(
) → ConfirmationStatus -
On Android devices it is the responsibility of the application developer to ensure that
the application user is informed about the collection of characteristic information
regarding nearby mobile and Wi-Fi network signals. Additionally, a link to the related
HERE Privacy Notice
must be made available to the user.
override
-
getBackgroundLocationAllowed(
) → bool -
On iOS devices this checks if application's background location updates are enabled.
Returns true if background location updates are allowed, false otherwise.
override
-
getBackgroundLocationIndicatorVisible(
) → bool -
On iOS devices this checks if application's background location indicator is visible.
Returns true if background location indicator is visible, false otherwise.
override
-
getPauseLocationUpdatesAutomatically(
) → bool -
On iOS devices this checks if automatic pausing of location updates is enabled.
Returns true if automatic pausing of location updates is enabled, false otherwise.
override
-
internalsetCallListenerFromMainThreadEnabled(
bool enabled) → void - Enables or disables forcing listener calls to originate from main thread.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeLocationIssueListener(
LocationIssueListener listener) → void -
Removes a LocationIssueListener from the engine.
override
-
removeLocationListener(
LocationListener listener) → void -
Removes a LocationListener from the engine.
override
-
removeLocationStatusListener(
LocationStatusListener listener) → void -
Removes a LocationStatusListener from the engine.
override
-
setBackgroundLocationAllowed(
bool allowed) → LocationEngineStatus -
On iOS devices this enables or disables application's background location updates.
By default background location updates
are enabled if application has background location capabilities.
Set
allowedto true to allow background location updates, or false to disable them. Returns LocationEngineStatus.ok if call succeeds. LocationEngineStatus.notAllowed if the application does not have background location capabilities enabled.override -
setBackgroundLocationIndicatorVisible(
bool visible) → LocationEngineStatus -
On iOS devices this controls visibility of application's background location indicator.
By default background location indicator
is visible, if application has background location capabilities.
Set
visibleto true to show background location indicator, or false to hide it. Returns LocationEngineStatus.ok if call succeeds and LocationEngineStatus.notAllowed if the application does not have background location capabilities enabled.override -
setLastKnownLocationPersistent(
bool persistent) → LocationEngineStatus -
On Android devices this enables or disables saving of last known location so
that it persists across application sessions.
By default persistent saving across sessions is enabled.
Set
persistentto true to enable last known location to persist across application sessions, or false to disable it. When calling this method then LocationEngineStatus.ok is returned.override -
setPauseLocationUpdatesAutomatically(
bool allowed) → LocationEngineStatus -
On iOS devices this 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.
Set
allowedto true to allow automatic pausing of location updates, or false to disable them. When calling this method then LocationEngineStatus.ok is returned.override -
startWithLocationAccuracy(
LocationAccuracy locationAccuracy) → LocationEngineStatus -
Starts the location engine with desired LocationAccuracy.
Make sure to call either LocationEngine.confirmHEREPrivacyNoticeInclusion or
LocationEngine.confirmHEREPrivacyNoticeException beforehand.
Returns LocationEngineStatus.alreadyStarted if LocationEngine.startWithLocationAccuracy or
LocationEngine.startWithLocationOptions is called again without calling LocationEngine.stop in between.
See LocationEngineStatus for other possible return values.
override
-
startWithLocationOptions(
LocationOptions locationOptions) → LocationEngineStatus -
On Android devices starts the location engine with desired LocationOptions.
Make sure to call either LocationEngine.confirmHEREPrivacyNoticeInclusion or
LocationEngine.confirmHEREPrivacyNoticeException beforehand.
Returns LocationEngineStatus.alreadyStarted if LocationEngine.startWithLocationAccuracy or
LocationEngine.startWithLocationOptions is called again without calling LocationEngine.stop in between.
See LocationEngineStatus for other possible return values.
override
-
stop(
) → void -
Stops the location engine.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
updateLocationAccuracy(
LocationAccuracy locationAccuracy) → LocationEngineStatus -
Reconfigures the location engine with desired LocationAccuracy.
override
-
updateLocationOptions(
LocationOptions locationOptions) → LocationEngineStatus -
Reconfigures the location engine with desired LocationOptions.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited