Class LocationManager
- All Implemented Interfaces:
LocationListener
LocationManager listens to position updates and provides the map-matched location using the LocationManagerListener.
Note: This is a beta release of this feature. There may be bugs and unexpected behaviors. Related APIs may change in future releases without a deprecation process.
-
Constructor Summary
ConstructorsConstructorDescriptionLocationManager(SDKNativeEngine sdkEngine) Creates a new instance ofLocationManager. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMatchedLocationListener(MatchedLocationListener matchedLocationListener) Adds theMatchedLocationListenerto the subscribtion list.voidonLocationUpdated(Location location) Called each time a new location is available.voidremoveMatchedLocationListener(MatchedLocationListener matchedLocationListener) Removes theMatchedLocationListenerfrom the subscribtion list.voidsetMapMatcher(MapMatcher mapMatcher) Sets theMapMatcherfor exclusive use byLocationManager.Retrieves and removes theMapMatcherfromLocationManager.
-
Constructor Details
-
LocationManager
Creates a new instance of
LocationManager.- Parameters:
sdkEngine-A SDKEngine instance.
- Throws:
InstantiationErrorException-Instantiation error.
-
-
Method Details
-
setMapMatcher
Sets the
MapMatcherfor exclusive use byLocationManager.Threading: This method is asynchronous and performs the switch in an internal thread of
LocationManager. Note: After calling this method, theMapMatcheris owned and used exclusively byLocationManagerin its internal processing thread. Do not use or access theMapMatcherelsewhere while it is set.- Parameters:
mapMatcher-The
MapMatcherinstance to be used exclusively byLocationManager.
-
takeMapMatcher
Retrieves and removes the
MapMatcherfromLocationManager. Note: After calling this method,LocationManagerwill no longer use theMapMatcherat all. the caller regains full ownership and responsibility for theMapMatcher.- Returns:
The
MapMatcherinstance previously set, ornullif none was set.
-
addMatchedLocationListener
Adds the
MatchedLocationListenerto the subscribtion list.- Parameters:
matchedLocationListener-Listener to be added to the map matched location updates.
-
removeMatchedLocationListener
Removes the
MatchedLocationListenerfrom the subscribtion list.- Parameters:
matchedLocationListener-Listener to be removed from the map matched location updates.
-
onLocationUpdated
Called each time a new location is available. In a navigation context while using the
NavigatororVisualNavigator, it's required to set theLocation.timeparameter for eachLocationobject so that the HERE SDK can map-match the locations properly. If theLocation.timeparameter is missing, the location will be ignored. For navigation, it is also recommended to provide thebearingandspeedparameters for eachLocationobject. Invoked on the main thread.- Specified by:
onLocationUpdatedin interfaceLocationListener- Parameters:
location-Current location.
-