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
enableReroutingWithParameters: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 |
|
|
|
◆ enableReroutingWithParameters:completion:
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.
- Parameters
-
| parameters | An AGSReroutingParameters allow customizing background rerouting. |
| completion | The error parameter is populated on failure. |
- Returns
- An operation which can be canceled.
- Since
- 100.11
◆ 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 (NO 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
- Deprecated:
- 100.11.0. Use
enableReroutingWithParameters:completion: instead.
Provided by category AGSRouteTracker(AGSDeprecated).
◆ 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. |
- Returns
- A new route tracker.
- 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