MQNavigationManagerDelegate
@protocol MQNavigationManagerDelegate <NSObject>
The MQNavigationManagerDelegate protocol defines the methods that a delegate of an MQNavigationManager object can implement to handle events specific to navigation
-
Called after starting navigation
Declaration
Objective-C
- (void)navigationManagerDidStartNavigation: (nonnull MQNavigationManager *)navigationManager;
Swift
optional func navigationManagerDidStartNavigation(_ navigationManager: MQNavigationManager)
Parameters
navigationManager
NavigationManager object informing the delegate of this impending event
-
Called when navigation is stopped
Declaration
Objective-C
- (void)navigationManager:(nonnull MQNavigationManager *)navigationManager stoppedNavigation:(MQNavigationStoppedReason)navigationStoppedReason;
Swift
optional func navigationManager(_ navigationManager: MQNavigationManager, stoppedNavigation navigationStoppedReason: MQNavigationStoppedReason)
Parameters
navigationManager
NavigationManager object informing the delegate of this impending event
navigationStoppedReason
Reason navigation was stopped
-
Called when the navigation manager is paused
Declaration
Objective-C
- (void)navigationManagerDidPauseNavigation: (nonnull MQNavigationManager *)navigationManager;
Swift
optional func navigationManagerDidPauseNavigation(_ navigationManager: MQNavigationManager)
Parameters
navigationManager
NavigationManager object informing the delegate of this impending event
-
Called when the navigation manager is resumed
Declaration
Objective-C
- (void)navigationManagerDidResumeNavigation: (nonnull MQNavigationManager *)navigationManager;
Swift
optional func navigationManagerDidResumeNavigation(_ navigationManager: MQNavigationManager)
Parameters
navigationManager
NavigationManager object informing the delegate of this impending event
-
Called after attempting to start navigation, but encountering an error
Declaration
Objective-C
- (void)navigationManager:(nonnull MQNavigationManager *)navigationManager failedToStartNavigationWithError:(nonnull NSError *)error;
Swift
optional func navigationManager(_ navigationManager: MQNavigationManager, failedToStartNavigationWithError error: Error)
Parameters
navigationManager
NavigationManager object informing the delegate of this impending event
error
An NSError object describing the error
-
Called when the user crosses a border of speed limit span\s
Note
This method can be called with null parameters. At least one of the parameters will not be nullDeclaration
Objective-C
- (void)navigationManager:(nonnull MQNavigationManager *)navigationManager crossedSpeedLimitBoundariesWithExitedZones: (nullable NSSet<MQSpeedLimit *> *)exitedSpeedLimits enteredZones: (nullable NSSet<MQSpeedLimit *> *) enteredSpeedLimits;
Swift
optional func navigationManager(_ navigationManager: MQNavigationManager, crossedSpeedLimitBoundariesWithExitedZones exitedSpeedLimits: Set<MQSpeedLimit>?, enteredZones enteredSpeedLimits: Set<MQSpeedLimit>?)
Parameters
navigationManager
NavigationManager object informing the delegate of this impending event
exitedSpeedLimits
List of speed limit spans that the user exited
enteredSpeedLimits
List of speed limit spans that the user entered
-
Called when the upcoming manuever has been updated. This is called when the user goes past a maneuver
Declaration
Objective-C
- (void)navigationManager:(nonnull MQNavigationManager *)navigationManager didUpdateUpcomingManeuver:(nonnull MQManeuver *)upcomingManeuver;
Swift
optional func navigationManager(_ navigationManager: MQNavigationManager, didUpdateUpcomingManeuver upcomingManeuver: MQManeuver)
Parameters
navigationManager
NavigationManager object informing the delegate of this impending event
upcomingManeuver
Upcoming maneuver in the list of maneuvers in current routeleg
-
Called when navigition is running and a new location has been delievered
Warning
This is called very often. Do not do anything processor intensive in this methodDeclaration
Objective-C
- (void)navigationManager:(nonnull MQNavigationManager *)navigationManager receivedLocationObservation: (nonnull MQLocationObservation *)locationObservation;
Swift
optional func navigationManager(_ navigationManager: MQNavigationManager, receivedLocationObservation locationObservation: MQLocationObservation)
Parameters
navigationManager
NavigationManager object informing the delegate of this impending event
locationObservation
Contains raw GPS location and snapped location on the route
-
Called when navigition is running and a new location with bad accuracy has been delievered
Declaration
Objective-C
- (void)navigationManager:(nonnull MQNavigationManager *)navigationManager receivedInaccurateObservation:(nonnull CLLocation *)location;
Swift
optional func navigationManager(_ navigationManager: MQNavigationManager, receivedInaccurateObservation location: CLLocation)
Parameters
navigationManager
NavigationManager object informing the delegate of this impending event
location
Raw GPS location with bad accuracy
-
Called when a destination has been reached (this can be a destination along a multipoint route).
Warning
If not implemented we assume the acceptance is true.
Declaration
Objective-C
- (void)navigationManager:(nonnull MQNavigationManager *)navigationManager reachedDestinationForRouteLeg:(nonnull MQRouteLeg *)completedRouteLeg isFinalDestination:(BOOL)isFinalDestination confirmArrival:(nonnull void (^)(BOOL))confirmArrival;
Swift
optional func navigationManager(_ navigationManager: MQNavigationManager, reachedDestinationFor completedRouteLeg: MQRouteLeg, isFinalDestination: Bool, confirmArrival: @escaping (Bool) -> Void)
Parameters
navigationManager
NavigationManager object informing the delegate of this impending event
completedRouteLeg
The route leg that was just completed
isFinalDestination
If we have reached the final leg of the route
confirmArrival
Required callback to accept reaching the destination. If accepted the NavigationManager will continue to the next destination or if reaching the final destination, stop navigation
-
Called when we have detected a situation where a reroute should happen.
Warning
if this method is not implemented, NavigationSDK will go ahead and reroute
Declaration
Objective-C
- (BOOL)navigationManagerShouldReroute: (nonnull MQNavigationManager *)navigationManager;
Swift
optional func navigationManagerShouldReroute(_ navigationManager: MQNavigationManager) -> Bool
Parameters
navigationManager
NavigationManager object informing the delegate of this impending event
Return Value
return a bool to indicate whether navigation manager should reroute or not
-
Called when we have detected a situation where a reroute should happen
Declaration
Objective-C
- (void)navigationManagerWillReroute: (nonnull MQNavigationManager *)navigationManager;
Swift
optional func navigationManagerWillReroute(_ navigationManager: MQNavigationManager)
Parameters
navigationManager
NavigationManager object informing the delegate of this impending event
-
Called after a new route has been provided after a reroute
Declaration
Objective-C
- (void)navigationManager:(nonnull MQNavigationManager *)navigationManager didReroute:(nonnull MQRoute *)route;
Swift
optional func navigationManager(_ navigationManager: MQNavigationManager, didReroute route: MQRoute)
Parameters
navigationManager
NavigationManager object informing the delegate of this impending event
route
New route that the navigation manager is using
-
Called when a failure happened whele we attempted a reroute
Declaration
Objective-C
- (void)navigationManager:(nonnull MQNavigationManager *)navigationManager failedToRerouteWithError:(nonnull NSError *)error;
Swift
optional func navigationManager(_ navigationManager: MQNavigationManager, failedToRerouteWithError error: Error)
Parameters
navigationManager
NavigationManager object informing the delegate of this impending event
error
Error details
-
Called when we attempted a reroute but the users current posision would not work for the route we retrieved. This can happen on slow networks.
Note
This can also happen if the user gets back on the original route when the reroute is receivedDeclaration
Objective-C
- (void)navigationManagerDiscardedReroute: (nonnull MQNavigationManager *)navigationManager;
Swift
optional func navigationManagerDiscardedReroute(_ navigationManager: MQNavigationManager)
Parameters
navigationManager
NavigationManager object informing the delegate of this impending event
-
Called when we are going to check traffic conditions have changed
Declaration
Objective-C
- (void)navigationManagerWillUpdateTraffic: (nonnull MQNavigationManager *)navigationManager;
Swift
optional func navigationManagerWillUpdateTraffic(_ navigationManager: MQNavigationManager)
Parameters
navigationManager
NavigationManager object informing the delegate of this impending event
-
Called when we have updated traffic conditions. Access it from navigationManager.currentRouteLeg.traffic
Declaration
Objective-C
- (void)navigationManagerDidUpdateTraffic: (nonnull MQNavigationManager *)navigationManager withTrafficByRouteLegId: (nonnull NSDictionary<NSString *, MQTraffic *> *) trafficByRouteLegId;
Swift
optional func navigationManagerDidUpdateTraffic(_ navigationManager: MQNavigationManager, withTrafficByRouteLegId trafficByRouteLegId: [String : MQTraffic])
Parameters
navigationManager
NavigationManager object informing the delegate of this impending event
trafficByRouteLegId
A dictionary that contains keys routeLegId and corresponding traffic
-
Called when we are going to check if the Estimated Time of Arrival is changed
Declaration
Objective-C
- (void)navigationManagerWillUpdateETA: (nonnull MQNavigationManager *)navigationManager;
Swift
optional func navigationManagerWillUpdateETA(_ navigationManager: MQNavigationManager)
Parameters
navigationManager
NavigationManager object informing the delegate of this impending event
-
Called when we have updated ETA. You can access it from Access it from navigationManager.currentRouteLeg.traffic.estimatedTimeOfArrival
Declaration
Objective-C
- (void) navigationManagerDidUpdateETA:(nonnull MQNavigationManager *)navigationManager withETAByRouteLegId: (nonnull NSDictionary<NSString *, MQEstimatedTimeOfArrival *> *) etaByRouteLegId;
Swift
optional func navigationManagerDidUpdateETA(_ navigationManager: MQNavigationManager, withETAByRouteLegId etaByRouteLegId: [String : MQEstimatedTimeOfArrival])
Parameters
navigationManager
NavigationManager object informing the delegate of this impending event
-
Deprecated: use navigationManagerDidUpdateETA:withETAByRouteLegId: instead Called when we have updated ETA. You can access it from Access it from navigationManager.currentRouteLeg.traffic.estimatedTimeOfArrival
Declaration
Objective-C
- (void)navigationManagerDidUpdateETA: (nonnull MQNavigationManager *)navigationManager withETA:(nonnull MQEstimatedTimeOfArrival *)eta;
Swift
optional func navigationManagerDidUpdateETA(_ navigationManager: MQNavigationManager, withETA eta: MQEstimatedTimeOfArrival)
Parameters
navigationManager
NavigationManager object informing the delegate of this impending event
-
Called when a traffic update check has failed
Declaration
Objective-C
- (void)navigationManager:(nonnull MQNavigationManager *)navigationManager failedToUpdateTrafficWithError:(nonnull NSError *)error;
Swift
optional func navigationManager(_ navigationManager: MQNavigationManager, failedToUpdateTrafficWithError error: Error)
Parameters
navigationManager
NavigationManager object informing the delegate of this impending event
error
Error details
-
Called when a eta update check has failed
Declaration
Objective-C
- (void)navigationManager:(nonnull MQNavigationManager *)navigationManager failedToUpdateEtaWithError:(nonnull NSError *)error;
Swift
optional func navigationManager(_ navigationManager: MQNavigationManager, failedToUpdateEtaWithError error: Error)
Parameters
navigationManager
NavigationManager object informing the delegate of this impending event
error
Error details
-
Called when we have a new route due to traffic. Developer is responsible for using the provided route and start navigating with new route
Declaration
Objective-C
- (void)navigationManager:(nonnull MQNavigationManager *)navigationManager foundTrafficReroute:(nonnull MQRoute *)route;
Swift
optional func navigationManager(_ navigationManager: MQNavigationManager, foundTrafficReroute route: MQRoute)
Parameters
navigationManager
NavigationManager
route
An alternate Route to current route
-
Called when the app is in the background, device is running on battery, and the user has not moved out of the area in a period of time. You can react to this callback by bringing up a notification for the user to continue navigation, pausing navigation, or exiting
Declaration
Objective-C
- (void)navigationManagerBackgroundTimerExpired: (nonnull MQNavigationManager *)navigationManager;
Swift
optional func navigationManagerBackgroundTimerExpired(_ navigationManager: MQNavigationManager)
Parameters
navigationManager
NavigationManager