Class LocationSimulator

java.lang.Object
com.here.NativeBase
com.here.sdk.navigation.LocationSimulator

public final class LocationSimulator extends NativeBase

Use the LocationSimulator to generate locations along a route or a GPX document. It notifies the registered object about the current location at a fixed interval. In order to customize the interval, see LocationSimulatorOptions. The locations are closely matched to the shape and proceeded from the start to the destination as found in the provided route or the GPX document. When providing a route, the LocationSimulator uses a base speed taken from each span found in the provided route object. This base speed can be multiplied upfront with a custom speedFactor for simulation purposes. Effectively, this means that traffic-related information is not considered to adjust the speed of the simulation. For the GPXTrack, a speed is either based on timestamps in the original file or provided by the user. The following data is read from a GPXTrack and inserted into the provided Location object: latitude, longitude, altitude, time, bearingInDegrees, speedInMetersPerSecond, horizontalAccuracyInMeters, verticalAccuracyInMeters and locationTechnology.

Note that simulation works offline and independent from any map data

  • only the information found in the provided route or GPX document is considered.
  • When initializing the LocationSimulator with a route, then interpolations take place between the vertices of the route's polyline. The distance between interpolated locations is a function of the current span's speed and the set notification interval.
  • When initializing the LocationSimulator with a GPX file, the LocationSimulator does not apply any interpolation on the provided location data as this would shadow the recorded GPX data.

Notifications will stop after the entire route has been traveled.

Note: Map-matched locations are only accessible from RouteProgress.

  • Constructor Details

  • Method Details

    • start

      public void start()

      Starts the location provider to send notifications to the subscribers. Calling this method will always start the location simulator from the route's first Waypoint, even if a simulation has already been started or stopped.

    • stop

      public void stop()

      Stops the location provider from sending notifications to the subscribers.

    • pause

      public void pause()

      Pauses sending notifications to the subscribers. Calling this function has no effect when location provider is not started.

    • resume

      public void resume()

      Resumes sending notifications to the subscribers. Calling this function has no effect when location provider is not started.

    • getListener

      @Nullable public LocationListener getListener()

      Gets a LocationListener that notifies on location updates.

      Returns:

      The object that notifies on location updates.

    • setListener

      public void setListener(@Nullable LocationListener value)

      Sets a LocationListener that notifies on location updates.

      Parameters:
      value -

      The object that notifies on location updates.