Route Tracker
Uses a location to provide status and progress updates as a route is traversed (by a moving vehicle, for example). RouteTracker can give the time or distance to the next maneuver, notify if the location is off-route, and regenerate a new route if necessary. Basic workflow:
Create a new RouteTracker instance.
Enable rerouting with RouteTracker.enableRerouting(ReroutingParameters) (if supported by the underlying route service).
Use RouteTracker.trackLocation(Location) to track the location of the device.
Subscribe to RouteTracker.trackingStatusChanged to get the TrackingStatus as the location changes.
Subscribe to RouteTracker.newVoiceGuidance to get the VoiceGuidance whenever new instructions are available.
If there are multiple stops, call RouteTracker.switchToNextDestination() each time DestinationStatus.Reached status is returned. Before calling RouteTracker.switchToNextDestination() make sure that TrackingStatus.remainingDestinationCount 1, a value of 1 means the last destination is being approached.
Since
200.1.0
Constructors
Properties
Reports if routes are automatically regenerated when tracking status is off-route. True if rerouting is enabled, otherwise False.
Sets new voice guidance callback.
Sets reroute completed callback.
Sets reroute started callback.
Indicates if multiple stops in a row at the same location should treated as one stop. When true, if there are multiple stops, in a row, at the same network location the new voice guidance event will fire a single time and calling RouteTracker.switchToNextDestination() will skip over the other coincident stops, setting the state to the next relevant direction maneuver. If the value is false each stop will be treated as a unique destination. The default value for this property is true. If your route does not have coincident stops the value of this property will have no effect.
Status for the current location on the route.
The unit system used in voice guidance commands. Default value is UnitSystem.Metric. Supported values are UnitSystem.Metric and UnitSystem.Imperial.
Functions
Cancels a running reroute task. If rerouting is in progress, this method will interrupt the background route task process.
Disables automatic rerouting. When disabled, the tracker will not automatically recalculate a route when the tracking status is off-route.
Enables automatic rerouting when the tracker detects an off-route status. Re-routing only occurs when the current location is off-route, but on or near the transportation network edges. For example if an off-route state is detected but the tracked location is in a parking lot, away from any transportation network edges, re-routing will not occur, and will occur only once a subsequent tracked location is on or near the transportation network edges.
Gets the current VoiceGuidance object. The most recent voice guidance based on the last Location used by RouteTracker.trackLocation(Location). It can be used to repeat last/latest voice guidance.
Sets a callback which returns the speech engine ready status. Set the speech engine activity status using this lambda to avoid speech event conflicts. This logic is used by RouteTracker before new RouteTracker.newVoiceGuidance is raised to check if the speech engine is busy. If it is busy it will postpone raising the voice guidance event until next RouteTracker.trackLocation will be called. Here is an example of how it can be used with a text-to-speech engine:
Starts tracking progress to the next destination in the Route. Use RouteTracker.switchToNextDestination() when the tracker reports a DestinationStatus.Reached status. Before calling RouteTracker.switchToNextDestination() make sure that TrackingStatus.remainingDestinationCount 1 (a value of 1 means navigation is proceeding to last destination). This method can also be called after DestinationStatus.Approaching is raised in cases where the location cannot get near enough to the destination point for DestinationStatus.Reached to be raised (such as the center of a park or shopping center, for example). RouteTracker.trackLocation(Location) needs to be called at least once before calling this method otherwise an error will be thrown. RouteTracker.trackLocation(Location) is needed for getting TrackingStatus and for handling visitFirstStopOnStart.
Provides route tracking status relative to the provided location. The location generally comes from a GPS but may also be a simulated or manually entered location. It must have valid values for X and Y coordinates, speed (in meters per second), course (in degrees), and a timestamp. Events fired for RouteTracker when completed.