Uses a location to provide status and progress updates as a route is traversed (by a moving vehicle, for example).
AGSRouteTracker 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
AGSRouteTracker instance.
- Enable rerouting with
enableReroutingWithRouteTask:routeParameters:strategy:visitFirstStopOnStart:completion: (AGSRouteTracker) (if supported by the underlying route service).
- Use
trackLocation:completion: (AGSRouteTracker) to track the location of the device.
- Implement the delegate method
routeTracker:didUpdateTrackingStatus: (AGSRouteTrackerDelegate-p) to get the AGSTrackingStatus as the location changes.
- Implement the delegate method
routeTracker:didGenerateNewVoiceGuidance: (AGSRouteTrackerDelegate-p) to get the AGSVoiceGuidance whenever new instructions are available.
- If there are multiple stops, call
switchToNextDestinationWithCompletion: (AGSRouteTracker) each time AGSDestinationStatusReached status is returned. Before calling switchToNextDestinationWithCompletion: (AGSRouteTracker) make sure that AGSTrackingStatus::remainingDestinationCount > 1, a value of 1 means the last destination is being approached. - Since
- 100.6
§ cancelRerouting()
Cancels a running reroute operation. If rerouting is in progress, this method will interrupt the background route task operation.
- Since
- 100.6
§ disableRerouting()
| - (void) disableRerouting |
|
|
|
§ enableReroutingWithRouteTask:routeParameters:strategy:visitFirstStopOnStart:completion:()
Enables automatic rerouting when the tracker detects an off-route status. Rerouting is initiated automatically when the tracking status is off-route. In order to be considered off-route, the location must be on the transportation network as well as off the current route. If a tracked location is in a parking lot, for example, it is not considered off-route and rerouting will not occur. If the next location is on the network but not on the route, automatic rerouting will begin.
- Parameters
-
| routeTask | An AGSRouteTask capable of solving routes on the same network used by the original route. |
| routeParameters | An AGSRouteParameters object that defines parameters for the rerouting AGSRouteTask. |
| strategy | A rerouting strategy that determines how new routes are created (to the next waypoint by default). |
| visitFirstStopOnStart | Whether the first stop must be visited when rerouted (false by default). |
| completion | The #error parameter is populated on failure. |
- Returns
- An operation which can be canceled.
- See also
AGSRouteTask, AGSRouteParameters, AGSReroutingStrategy
- Since
- 100.6
§ generateVoiceGuidance()
§ initWithRouteResult:routeIndex:()
| - (nullable instancetype) initWithRouteResult: |
|
(AGSRouteResult *) |
routeResult |
| routeIndex: |
|
(NSInteger) |
routeIndex |
|
|
| |
§ initWithRouteResult:routeIndex:skipCoincidentStops:()
| - (nullable instancetype) initWithRouteResult: |
|
(AGSRouteResult *) |
routeResult |
| routeIndex: |
|
(NSInteger) |
routeIndex |
| skipCoincidentStops: |
|
(BOOL) |
skipCoincidentStops |
|
|
| |
Creates an AGSRouteTracker object using a specific route from a route result with an option to specify treating coincident stops as a single destination. Will return nil if the AGSRoute is not found or if it lacks AGSRoute::stops and AGSRoute::directionManeuvers.
- Parameters
-
| routeResult | An AGSRouteResult generated from route task solve |
| routeIndex | The integer value for which route to use in the array of AGSRouteResult::routes. The array is zero-based. |
| skipCoincidentStops | Determines if coincident stops (multiple stops in a row at the same location) should be treated as a single destination. |
- See also
AGSRouteResult
- Since
- 100.9
§ routeTrackerWithRouteResult:routeIndex:()
| + (nullable instancetype) routeTrackerWithRouteResult: |
|
(AGSRouteResult *) |
routeResult |
| routeIndex: |
|
(NSInteger) |
routeIndex |
|
|
| |
§ routeTrackerWithRouteResult:routeIndex:skipCoincidentStops:()
| + (nullable instancetype) routeTrackerWithRouteResult: |
|
(AGSRouteResult *) |
routeResult |
| routeIndex: |
|
(NSInteger) |
routeIndex |
| skipCoincidentStops: |
|
(BOOL) |
skipCoincidentStops |
|
|
| |
Creates a route tracker using a specific route from a route result with an option to specify treating coincident stops as a single destination. Will return nil if the AGSRoute is not found or if it lacks AGSRoute::stops and AGSRoute::directionManeuvers.
- Parameters
-
| routeResult | An AGSRouteResult generated from route task solve. |
| routeIndex | The integer value for which route to use in the array of AGSRouteResult::routes. The array is zero-based. |
| skipCoincidentStops | Determines if coincident stops (multiple stops in a row at the same location) should be treated as a single destination. |
- See also
AGSRouteResult
- Since
- 100.9
§ switchToNextDestinationWithCompletion:()
| - (id<AGSCancelable>) switchToNextDestinationWithCompletion: |
|
(nullable void(^)(NSError *__nullable error)) |
completion |
|
§ delegate
§ reroutingEnabled
| - (BOOL) reroutingEnabled |
|
readnonatomicassign |
§ skipCoincidentStops
| - (BOOL) skipCoincidentStops |
|
readnonatomicassign |
Indicates whether multiple stops in a row at the same location should be treated as one stop.
When YES, 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 switchToNextDestinationWithCompletion: will skip over the other coincident stops, setting the state to the next relevant direction maneuver. If the value is NO, each stop will be treated as a unique destination. The default value for this property is YES. If your route does not have coincident stops the value of this property will have no effect.
- Since
- 100.9
§ trackingStatus
§ voiceGuidanceUnitSystem
The unit system used in voice guidance commands Default value is AGSUnitSystemMetric. Supported values are AGSUnitSystemMetric and AGSUnitSystemImperial.
- Since
- 100.6