Interface LocationEngineBase
- Last UpdatedJun 10, 2025
- 5 minute read
-
- All Known Implementing Classes:
LocationEngine
public interface LocationEngineBase
Public interface that describes the behaviour of
LocationEngine
. Implementation is platform-specific.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addLocationIssueListener(LocationIssueListener listener)
Adds aLocationIssueListener
to the engine to get notified when a location issue has occurred.void
addLocationListener(LocationListener listener)
Adds aLocationListener
to the engine to get notified when there is a new location update available.void
addLocationStatusListener(LocationStatusListener listener)
Adds aLocationStatusListener
to the engine to get notified when there is an important status change.ConfirmationStatus
confirmHEREPrivacyNoticeException()
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.ConfirmationStatus
confirmHEREPrivacyNoticeInclusion()
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.Location
getLastKnownLocation()
Gets the last known location obtained by theLocationEngine
.boolean
isStarted()
Checks if the engine is in started state.void
removeLocationIssueListener(LocationIssueListener listener)
Removes aLocationIssueListener
from the engine.void
removeLocationListener(LocationListener listener)
Removes aLocationListener
from the engine.void
removeLocationStatusListener(LocationStatusListener listener)
Removes aLocationStatusListener
from the engine.LocationEngineStatus
setLastKnownLocationPersistent(boolean persistent)
Enables or disables saving of last known location so that it persists between application sessions.LocationEngineStatus
start(LocationAccuracy locationAccuracy)
Starts the location engine with desiredLocationAccuracy
.LocationEngineStatus
start(LocationOptions locationOptions)
Starts the location engine with desiredLocationOptions
.void
stop()
Stops the location engine.LocationEngineStatus
updateLocationAccuracy(LocationAccuracy locationAccuracy)
Reconfigures the location engine with desiredLocationAccuracy
.LocationEngineStatus
updateLocationOptions(LocationOptions locationOptions)
Reconfigures the location engine with desiredLocationOptions
.
-
-
-
Method Detail
-
start
@NonNull LocationEngineStatus start(@NonNull LocationAccuracy locationAccuracy)
Starts the location engine with desired
LocationAccuracy
. ReturnsLocationEngineStatus.ALREADY_STARTED
, ifstart(LocationOptions)
is called again withoutstop()
in between. Make sure to call eitherconfirmHEREPrivacyNoticeInclusion()
orconfirmHEREPrivacyNoticeException()
beforehand.- Parameters:
locationAccuracy
-Desired location accuracy. Requested accuracy is not guaranteed.
- Returns:
Engine status. Valid values are defined in
LocationEngineStatus
-
start
@NonNull LocationEngineStatus start(@NonNull LocationOptions locationOptions)
Starts the location engine with desired
LocationOptions
. ReturnsLocationEngineStatus.ALREADY_STARTED
, ifstart(LocationOptions)
is called again withoutstop()
in between. Make sure to call eitherconfirmHEREPrivacyNoticeInclusion()
orconfirmHEREPrivacyNoticeException()
beforehand.- Parameters:
locationOptions
-Desired location options.
- Returns:
Engine status. Valid values are defined in
LocationEngineStatus
-
updateLocationAccuracy
@NonNull LocationEngineStatus updateLocationAccuracy(@NonNull LocationAccuracy locationAccuracy)
Reconfigures the location engine with desired
LocationAccuracy
. This method is a faster way to change location accuracy for already started location engine, than callingstop()
andstart(LocationOptions)
in sequence. ReturnsLocationEngineStatus.NOT_READY
, if called for unstarted location engine.- Parameters:
locationAccuracy
-Desired location accuracy. Requested accuracy is not guaranteed.
- Returns:
Engine status. Valid values are defined in
LocationEngineStatus
-
updateLocationOptions
@NonNull LocationEngineStatus updateLocationOptions(@NonNull LocationOptions locationOptions)
Reconfigures the location engine with desired
LocationOptions
. This method is a faster way to change location options for already started location engine, than callingstop()
andstart(LocationOptions)
in sequence. ReturnsLocationEngineStatus.NOT_READY
, if called for unstarted location engine.- Parameters:
locationOptions
-Desired location options.
- Returns:
Engine status. Valid values are defined in
LocationEngineStatus
-
stop
void stop()
Stops the location engine.
-
confirmHEREPrivacyNoticeInclusion
@NonNull ConfirmationStatus confirmHEREPrivacyNoticeInclusion()
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.
This information can be included in the application's Terms & Conditions, Privacy Policy, or otherwise made accessible to the user.
An example text for informing users about the data collection: "This application uses location services provided by HERE Technologies. To maintain, improve, and provide these services, HERE Technologies occasionally collects characteristic information about nearby mobile and Wi-Fi network signals. For more information, please refer to the HERE Privacy Notice at: https://legal.here.com/en-gb/here-network-positioning-via-sdk"
Note: By calling this method, the application developer confirms that this information is made available to the end user.
For example, it is sufficient to inform users once that using the app requires acceptance of its terms (if any). Then, in the terms include the above mentioned data collection information and a link to the related HERE Privacy Notice. The user is not required to open the terms to acknowledge the data collection details. The "Positioning" example app on GitHub provides an example of this.
When the above criteria are met, it is recommended to silently execute this method each time before starting the
LocationEngine
, as failure to do so will result in the engine being non-functional.- Returns:
Immediately returns with
ConfirmationStatus.OK
.
-
confirmHEREPrivacyNoticeException
@NonNull ConfirmationStatus confirmHEREPrivacyNoticeException()
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
LocationEngine
will not collect characteristic information about the nearby mobile and Wi-Fi network signals. However, the engine will still be fully functional and it will deliver location updates when the exception can be confirmed. Note that this call should not involve user interaction and it should be executed silently by the application before starting theLocationEngine
.The permission for exceptional use will be verified asynchronously using your HERE SDK credentials. A missing permission will lead to stopping of the
LocationEngine
andLocationEngineStatus.PRIVACY_NOTICE_UNCONFIRMED
is delivered toLocationStatusListener
.- Returns:
Confirmation action status. Valid values are defined in
ConfirmationStatus
. A first-time call may result inConfirmationStatus.PENDING
, make sure to use theLocationStatusListener
to get notified on an unconfirmed permission.
-
addLocationListener
void addLocationListener(@NonNull LocationListener listener)
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.- Parameters:
listener
-The listener.
-
removeLocationListener
void removeLocationListener(@NonNull LocationListener listener)
Removes a
LocationListener
from the engine.- Parameters:
listener
-The listener.
-
addLocationStatusListener
void addLocationStatusListener(@NonNull LocationStatusListener listener)
Adds a
LocationStatusListener
to the engine to get notified when there is an important status change. Supports more than one listener, instance is added only once.- Parameters:
listener
-The listener.
-
removeLocationStatusListener
void removeLocationStatusListener(@NonNull LocationStatusListener listener)
Removes a
LocationStatusListener
from the engine.- Parameters:
listener
-The listener.
-
addLocationIssueListener
void addLocationIssueListener(@NonNull LocationIssueListener listener)
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.- Parameters:
listener
-The listener.
-
removeLocationIssueListener
void removeLocationIssueListener(@NonNull LocationIssueListener listener)
Removes a
LocationIssueListener
from the engine.- Parameters:
listener
-The listener.
-
setLastKnownLocationPersistent
@NonNull LocationEngineStatus setLastKnownLocationPersistent(boolean persistent)
Enables or disables saving of last known location so that it persists between application sessions. Defaults to enabled.
- Parameters:
persistent
-Set to
true
to enable last known location to be saved persistently, orfalse
to disable it.- Returns:
LocationEngineStatus.OK
if call succeeds.LocationEngineStatus.NOT_SUPPORTED
on platforms which do not support controlling of last known location saving.
-
getLastKnownLocation
@Nullable Location getLastKnownLocation()
Gets the last known location obtained by the
LocationEngine
. It is persisted throughout the app's lifecycle. This property can be obtained without starting theLocationEngine
. However, the initial value might benull
if no location has ever been obtained by theLocationEngine
. The time attribute of theLocation
object indicates when the last location was obtained. Note: In order to receive continuous location updates, add aLocationListener
.- Returns:
The last known location obtained by the
LocationEngine
. It is persisted throughout the app's lifecycle. This property can be obtained without starting theLocationEngine
. However, the initial value might benull
if no location has ever been obtained by theLocationEngine
. The time attribute of theLocation
object indicates when the last location was obtained. Note: In order to receive continuous location updates, add aLocationListener
.
-
isStarted
boolean isStarted()
Checks if the engine is in started state.
- Returns:
Checks if the engine is in started state.
-
-