GoogleNavigation Framework Reference

GMSNavigatorListener

@protocol GMSNavigatorListener <NSObject>

Listener for events on GMSNavigator.

  • Called when the driver has arrived at a GMSNavigationWaypoint.

    Declaration

    Swift

    optional func navigator(_ navigator: GMSNavigator, didArriveAt waypoint: GMSNavigationWaypoint)

    Objective-C

    - (void)navigator:(nonnull GMSNavigator *)navigator
        didArriveAtWaypoint:(nonnull GMSNavigationWaypoint *)waypoint;

    Parameters

    waypoint

    The 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

    time

    The 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

    distance

    The 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

    delayCategory

    The 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

    lightingMode

    The 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

    navigator

    GMSNavigator that reports the speeding.

    percentageAboveLimit

    Percentage 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

    navigator

    GMSNavigator that reports the speeding.

    speedAlertSeverity

    The severity of the current speed alert. Set to GMSNavigationSpeedAlertSeverityUnknown when the speed limit is unknown or the speed is invalid. Set to GMSNavigationSpeedAlertSeverityNotSpeeding when the driver is not speeding according to the thresholds configured in GMSNavigationSpeedAlertOptions. When the driver is speeding this will be set to GMSNavigationSpeedAlertSeverityMinor or GMSNavigationSpeedAlertSeverityMajor according to the configured thresholds.

    percentageAboveLimit

    Percentage above the speed limit the driver is currently driving at. Only valid when speedAlertSeverity is Minor or Major.

  • Called when the current GMSNavigationNavInfo is 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

    navInfo

    The updated GMSNavigationNavInfo.