Class RouteTracker
Uses a location to provide status and progress updates as a route is traversed (by a moving vehicle, for example).
Namespace: Esri.ArcGISRuntime.Navigation
Assembly: Esri.ArcGISRuntime.dll
Syntax
public sealed class RouteTracker
Remarks
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:
- (1) Create a new RouteTracker instance.
- (2) Enable rerouting via EnableReroutingAsync(ReroutingParameters, CancellationToken) (if supported by the underlying route service).
- (3) Use TrackLocationAsync(Location, CancellationToken) to track the location of the device.
- (4) Subscribe to TrackingStatusChanged event to get the TrackingStatus as the location changes. For example, this can be used to show DisplayLocation in the GeoView.
- (5) Subscribe to NewVoiceGuidance to get the VoiceGuidance whenever new instructions are available.
- (6) If there are multiple stops, call SwitchToNextDestinationAsync(CancellationToken) each time Reached status is returned. Before calling SwitchToNextDestinationAsync(CancellationToken) make sure that RemainingDestinationCount > 1 (a value of 1 means the last destination is being approached).
Constructors
Name | Description |
---|---|
RouteTracker(RouteResult, Int32, Boolean) | Initializes a new instance of the RouteTracker class using a specific route from a route result with an option to specify treating coincident stops as a single destination. |
Properties
Name | Description |
---|---|
IsReroutingEnabled | Gets a value indicating whether routes are automatically regenerated when tracking status is off-route. |
SkipCoincidentStops | Gets a value indicating whether multiple stops in a row at the same location should be treated as one stop. |
TrackingStatus | Gets the latest TrackingStatus for the current location on the route. |
VoiceGuidanceUnitSystem | Gets or sets the unit system in voice guidance commands. |
Methods
Name | Description |
---|---|
CancelRerouting() | Cancels a running reroute task. |
DisableRerouting() | Disable automatic rerouting. |
EnableReroutingAsync(ReroutingParameters, CancellationToken) | Enables automatic rerouting when the tracker detects an off-route status. |
GenerateVoiceGuidance() | Gets the current VoiceGuidance object. |
SwitchToNextDestinationAsync(CancellationToken) | Starts tracking progress to the next destination in the Route. |
TrackLocationAsync(Location, CancellationToken) | Provides route tracking status relative to the provided location. |
Events
Name | Description |
---|---|
NewVoiceGuidance | Occurs when new VoiceGuidance instruction is generated by the voice guidance engine. |
RerouteCompleted | Occurs when re-routing is completed. |
RerouteStarted | Occurs when re-routing is started. |
TrackingStatusChanged | Occurs when the TrackingStatus is updated. |
Applies to
Target | Versions |
---|---|
.NET Standard 2.0 | 100.6 - 100.15 |
.NET 6.0 | 100.13 - 100.15 |
.NET 6.0 Windows | 100.13 - 100.15 |
.NET Framework | 100.6 - 100.15 |
.NET 5 | 100.10 - 100.12 |
.NET Core 3.1 | 100.7 - 100.12 |
Xamarin.Android | 100.6 - 100.15 |
Xamarin.iOS | 100.6 - 100.15 |
UWP | 100.6 - 100.15 |