GMSNavigatorListener
@protocol GMSNavigatorListener <NSObject>Listener for events on GMSNavigator.
-
Called when the driver has arrived at a
GMSNavigationWaypoint.Note
This method is called even if
stopGuidanceAtArrivalis set toNO.Note
When navigating a route with multiple waypoints, this method is called once for each waypoint.
Declaration
Swift
optional func navigator(_ navigator: GMSNavigator, didArriveAt waypoint: GMSNavigationWaypoint)Objective-C
- (void)navigator:(nonnull GMSNavigator *)navigator didArriveAtWaypoint:(nonnull GMSNavigationWaypoint *)waypoint;Parameters
waypointThe waypoint that was arrived at.
-
Called when the current route changes or is cleared.
Note that there are several types of triggers for this listener, including but not limited to:
- the in-progress trip was updated
- the driver diverged from the current route
- the driver selected an alternative route from the UI
- the driver was offered or required to use a better route
- the driver started navigating to a destination (via a call to setDestinations)
- the driver started navigating to a new waypoint after arriving at a previous one
- the route was cleared (via a call to clearDestinations)
Declaration
Swift
optional func navigatorDidChangeRoute(_ navigator: GMSNavigator)Objective-C
- (void)navigatorDidChangeRoute:(nonnull GMSNavigator *)navigator; -
Called when the estimated time(s) to the destination(s) are updated.
Declaration
Swift
optional func navigator(_ navigator: GMSNavigator, didUpdateRemainingTime time: TimeInterval)Objective-C
- (void)navigator:(nonnull GMSNavigator *)navigator didUpdateRemainingTime:(NSTimeInterval)time;Parameters
timeThe time to the next destination.
-
Called when the estimated distance(s) to the destination(s) are updated.
Declaration
Swift
optional func navigator(_ navigator: GMSNavigator, didUpdateRemainingDistance distance: CLLocationDistance)Objective-C
- (void)navigator:(nonnull GMSNavigator *)navigator didUpdateRemainingDistance:(CLLocationDistance)distance;Parameters
distanceThe distance to the next destination.
-
Called when the delay category to the destination(s) are updated.
Declaration
Swift
optional func navigator(_ navigator: GMSNavigator, didUpdate delayCategory: GMSNavigationDelayCategory)Objective-C
- (void)navigator:(nonnull GMSNavigator *)navigator didUpdateDelayCategory:(GMSNavigationDelayCategory)delayCategory;Parameters
delayCategoryThe delay category to the next destination.
-
Called when the estimated lighting conditions are updated, for example when night falls at the devices’s current location.
Declaration
Swift
optional func navigator(_ navigator: GMSNavigator, didChangeSuggestedLightingMode lightingMode: GMSNavigationLightingMode)Objective-C
- (void)navigator:(nonnull GMSNavigator *)navigator didChangeSuggestedLightingMode:(GMSNavigationLightingMode)lightingMode;Parameters
lightingModeThe suggested color mode to match the current lighting conditions.
-
Notifies you that the driver is exceeding the speed limit by the specified percentage.
Declaration
Swift
optional func navigator(_ navigator: GMSNavigator, didUpdateSpeedingPercentage percentageAboveLimit: CGFloat)Objective-C
- (void)navigator:(nonnull GMSNavigator *)navigator didUpdateSpeedingPercentage:(CGFloat)percentageAboveLimit;Parameters
navigatorGMSNavigatorthat reports the speeding.percentageAboveLimitPercentage above the speed limit the driver is currently driving at. Set to 0 when the driver is not speeding. Set to -1 when the speed limit or current speed is invalid.
-
Notifies you that the device has detected that the vehicle is exceeding the speed limit by the specified percentage along with the current speed alert severity. This is called at regular intervals whenever a valid speed or speed limit update is available. This usually results in frequent calls during active navigation when the driver is moving.
Declaration
Swift
optional func navigator(_ navigator: GMSNavigator, didUpdate speedAlertSeverity: GMSNavigationSpeedAlertSeverity, speedingPercentage percentageAboveLimit: CGFloat)Objective-C
- (void)navigator:(nonnull GMSNavigator *)navigator didUpdateSpeedAlertSeverity: (GMSNavigationSpeedAlertSeverity)speedAlertSeverity speedingPercentage:(CGFloat)percentageAboveLimit;Parameters
navigatorGMSNavigatorthat reports the speeding.speedAlertSeverityThe severity of the current speed alert. Set to
GMSNavigationSpeedAlertSeverityUnknownwhen the speed limit is unknown or the speed is invalid. Set toGMSNavigationSpeedAlertSeverityNotSpeedingwhen the driver is not speeding according to the thresholds configured inGMSNavigationSpeedAlertOptions.When the driver is speeding this will be set toGMSNavigationSpeedAlertSeverityMinororGMSNavigationSpeedAlertSeverityMajoraccording to the configured thresholds.percentageAboveLimitPercentage above the speed limit the driver is currently driving at. Only valid when speedAlertSeverity is Minor or Major.
-
Called when the current
GMSNavigationNavInfois updated. This is called regularly during active navigation.Declaration
Swift
optional func navigator(_ navigator: GMSNavigator, didUpdate navInfo: GMSNavigationNavInfo)Objective-C
- (void)navigator:(nonnull GMSNavigator *)navigator didUpdateNavInfo:(nonnull GMSNavigationNavInfo *)navInfo;Parameters
navInfoThe updated
GMSNavigationNavInfo. -
Tells the listener that a prompt will be presented during guided navigation.
A prompt is a modal UI element that covers some part of the screen and prevents other UI elements from being interacted with until it is dismissed (whether automatically, programmatically, or by user action).
Declaration
Swift
optional func navigatorWillPresentPrompt(_ navigator: GMSNavigator)Objective-C
- (void)navigatorWillPresentPrompt:(nonnull GMSNavigator *)navigator; -
Tells the listener that a prompt was dismissed during guided navigation.
Declaration
Swift
optional func navigatorDidDismissPrompt(_ navigator: GMSNavigator)Objective-C
- (void)navigatorDidDismissPrompt:(nonnull GMSNavigator *)navigator;