Class LocationManager

java.lang.Object
com.here.NativeBase
com.here.sdk.mapmatcher.LocationManager
All Implemented Interfaces:
LocationListener

public final class LocationManager extends NativeBase implements 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 Details

  • Method Details

    • setMapMatcher

      public void setMapMatcher(@Nullable MapMatcher mapMatcher)

      Sets the MapMatcher for exclusive use by LocationManager.

      Threading: This method is asynchronous and performs the switch in an internal thread of LocationManager. Note: After calling this method, the MapMatcher is owned and used exclusively by LocationManager in its internal processing thread. Do not use or access the MapMatcher elsewhere while it is set.

      Parameters:
      mapMatcher -

      The MapMatcher instance to be used exclusively by LocationManager.

    • takeMapMatcher

      @Nullable public MapMatcher takeMapMatcher()

      Retrieves and removes the MapMatcher from LocationManager. Note: After calling this method, LocationManager will no longer use the MapMatcher at all. the caller regains full ownership and responsibility for the MapMatcher.

      Returns:

      The MapMatcher instance previously set, or null if none was set.

    • addMatchedLocationListener

      public void addMatchedLocationListener(@NonNull MatchedLocationListener matchedLocationListener)

      Adds the MatchedLocationListener to the subscribtion list.

      Parameters:
      matchedLocationListener -

      Listener to be added to the map matched location updates.

    • removeMatchedLocationListener

      public void removeMatchedLocationListener(@NonNull MatchedLocationListener matchedLocationListener)

      Removes the MatchedLocationListener from the subscribtion list.

      Parameters:
      matchedLocationListener -

      Listener to be removed from the map matched location updates.

    • onLocationUpdated

      public void onLocationUpdated(@NonNull Location location)

      Called each time a new location is available. In a navigation context while using the Navigator or VisualNavigator, it's required to set the Location.time parameter for each Location object so that the HERE SDK can map-match the locations properly. If the Location.time parameter is missing, the location will be ignored. For navigation, it is also recommended to provide the bearing and speed parameters for each Location object. Invoked on the main thread.

      Specified by:
      onLocationUpdated in interface LocationListener
      Parameters:
      location -

      Current location.