Document Navigation SDK for iOS Guides Turn-by-Turn Navigation Navigation Events

Navigation Events

Overview

During real driving navigation, the Navigation SDK exposes navigation data in real time through the <AMapNaviDriveDataRepresentable> protocol. This enables you to build custom UI components and is ideal for HUD and smart hardware solutions. For cycling, refer to the <AMapNaviRideDataRepresentable> protocol; for walking, refer to the <AMapNaviWalkDataRepresentable> protocol.

Before You Begin

In a custom view scenario, before starting navigation, ensure that you have added the driveViewrideView, or walkView to the manager using the addDataRepresentative: method.

AMapNaviDriveView *driveView = [[AMapNaviDriveView alloc] initWithFrame:self.view.bounds];
[[AMapNaviDriveManager sharedInstance] addDataRepresentative: driveView];
[[AMapNaviDriveManager sharedInstance] addDataRepresentative:self];
[[AMapNaviDriveManager sharedInstance] calculateDriveRouteWithStartPOIInfo:self.startPOIInfo 
                                                                endPOIInfo:self.endPOIInfo 
                                                               wayPOIInfos:nil 
                                                           drivingStrategy:AMapNaviDrivingStrategyMultipleDefault];

Navigation Data

NaviInfo

NaviInfo provides key navigation information, such as the current road name, the time and distance remaining to the destination, and information about facilities that have not been bypassed. The top guidance panel of AMapNaviDriveView primarily obtains its data from this callback.

/**
 * @brief Callback for navigation information updates.
 * @param driveManager The driving navigation manager.
 * @param naviInfo     Navigation information. See the AMapNaviInfo class.
 */
- (void)driveManager:(AMapNaviDriveManager *)driveManager updateNaviInfo:(nullable AMapNaviInfo *)naviInfo;

Navi info panel displaying current road name, remaining distance and time, and the upcoming turn instruction on an AMAP map

Junction View

The junction view feature provides two callbacks: one for showing and one for hiding the junction image.

/**
 * @brief Callback when a junction view image needs to be displayed.
 * @param driveManager The driving navigation manager.
 * @param crossImage   The junction view image (aspect ratio: 25:16).
 */
- (void)driveManager:(AMapNaviDriveManager *)driveManager showCrossImage:(UIImage *)crossImage;

/**
 * @brief Callback when the junction view image needs to be hidden.
 * @param driveManager The driving navigation manager.
 */
- (void)driveManagerHideCrossImage:(AMapNaviDriveManager *)driveManager;

Junction view showing a 3D illustration of the upcoming expressway exit with lane guidance overlay      Junction view displaying the upcoming road layout and exit instruction with current speed indicator on an AMAP map

Lane Information

The lane information feature provides two callbacks: one for showing and one for hiding lane data. You can use the CreateLaneInfoImageWithLaneInfo(NSString *laneBackInfo, NSString *laneSelectInfo) method to create lane information images.

The lane type codes are as follows:

Code

Meaning

0

Straight

1

Left turn

2

Straight and left turn

3

Right turn

4

Straight and right turn

5

Left turn and U-turn

6

Left turn and right turn

7

Straight, left turn, and right turn

8

Right turn and U-turn

9

Straight and left turn U-turn

10

Straight and right turn U-turn

11

Left turn and left turn U-turn

12

Right turn and right turn U-turn

13

Straight with left lane widening

14

Left turn and left turn U-turn with left lane widening

16

Straight, left turn, and left U-turn

17

Right turn and left U-turn

18

Left turn, left U-turn, and right turn

19

Straight, right turn, and left U-turn

20

Left turn and right U-turn

21

Bus lane

23

Variable lane

255

(Only appears in laneSelectInfo) Indicates that the currently planned route cannot use this lane

/**
 * @brief Callback when lane information needs to be displayed.
 * @param driveManager   The driving navigation manager.
 * @param laneBackInfo   Lane background information. For example, @"1|0|0|4" indicates 4 lanes: left turn, straight, straight, right turn + straight.
 * @param laneSelectInfo Lane foreground information. The count must match laneBackInfo. For example, @"255|0|0|0" indicates that lanes 2, 3, and 4 (all straight) are selected.
 */
- (void)driveManager:(AMapNaviDriveManager *)driveManager showLaneBackInfo:(NSString *)laneBackInfo laneSelectInfo:(NSString *)laneSelectInfo;

/**
 * @brief Callback when lane information needs to be hidden.
 * @param driveManager The driving navigation manager.
 */
- (void)driveManagerHideLaneInfo:(AMapNaviDriveManager *)driveManager;

Lane information overlay showing directional arrow indicators for lane selection before the next maneuver

Turn Icon

Starting from SDK v6.2.0, the Navigation SDK provides a dedicated callback for turn icons. These icons include road network information for a more intuitive display.

/**
 * @brief Callback for turn icon updates during navigation. (since 6.2.0)
 * @param driveManager  The driving navigation manager.
 * @param turnIconImage The turn icon image. Default size is (255, 255).
 * @param turnIconType  The turn icon type. See the AMapNaviIconType class.
 */
- (void)driveManager:(AMapNaviDriveManager *)driveManager updateTurnIconImage:(nullable UIImage *)turnIconImage turnIconType:(AMapNaviIconType)turnIconType;

Turn icon display indicating the next navigation maneuver direction with distance countdown on an AMAP map

Traffic Status

The traffic status callback returns the traffic conditions for the current guided route. This data can be used to render a traffic bar chart.

/**
 * @brief Callback for traffic bar chart information updates.
 * @param driveManager  The driving navigation manager.
 * @param trafficStatus An array of traffic bar chart information. See the AMapNaviTrafficStatus class.
 */
- (void)driveManager:(AMapNaviDriveManager *)driveManager updateTrafficStatus:(nullable NSArray<AMapNaviTrafficStatus *> *)trafficStatus;

Traffic status bar chart showing real-time congestion conditions along the guided route with color-coded severity levels

Congestion Information

Starting from SDK v7.5.0, the Navigation SDK provides information about upcoming congestion areas.

/**
 * @brief Callback for updates on upcoming congestion area information. (since 7.5.0)
 * @param driveManager    The driving navigation manager.
 * @param congestionInfo  Congestion area information. See the AMapNaviCongestionInfo class. Returns nil if the vehicle has passed the congestion area or if it is no longer congested.
 */
- (void)driveManager:(AMapNaviDriveManager *)driveManager updateCongestionInfo:(nullable AMapNaviCongestionInfo *)congestionInfo;

Congestion information display showing upcoming traffic jam distance and estimated delay time on the navigation route

Camera Information

Camera information includes the camera type, whether it enforces speed limits, its latitude/longitude coordinates, and the distance from the vehicle's current position to the camera.

/**
 * @brief Callback for camera information updates. (since 5.0.0)
 * @param driveManager The driving navigation manager.
 * @param cameraInfos  Camera information. See the AMapNaviCameraInfo class.
 */
- (void)driveManager:(AMapNaviDriveManager *)driveManager updateCameraInfos:(nullable NSArray<AMapNaviCameraInfo *> *)cameraInfos;

Camera information overlay displaying an upcoming speed camera with distance countdown and speed limit on the route

Interval Camera Information

Starting from SDK v6.0.0, the Navigation SDK provides information about interval speed cameras. This includes the positional relationship between the vehicle and the interval speed camera section, as well as dynamically updated real-time information.

/**
 * @brief Callback for interval camera information updates. (since 6.0.0)
 * @param driveManager The driving navigation manager.
 * @param state        The positional relationship between the vehicle and the interval speed camera section. See the AMapNaviIntervalCameraPositionState class.
 * @param startInfo    Camera information for the start of the interval. See the AMapNaviCameraInfo class.
 * @param endInfo      Camera information for the end of the interval. See the AMapNaviCameraInfo class.
 */
- (void)driveManager:(AMapNaviDriveManager *)driveManager updateIntervalCameraWithPositionState:(AMapNaviIntervalCameraPositionState)state startInfo:(nullable AMapNaviCameraInfo *)startInfo endInfo:(nullable AMapNaviCameraInfo *)endInfo;

Interval speed check camera information showing the start point and speed limit of an average speed monitoring section

Service Area and Toll Station Information

Starting from SDK v5.0.0, the Navigation SDK provides information about service areas and toll stations. This includes the service area type, name, latitude/longitude coordinates, and the distance from the vehicle's current position to the service area.

/**
 * @brief Callback for service area and toll station information updates. since 5.0.0
 * @param driveManager The driving navigation manager.
 * @param serviceAreaInfos Service area information. Refer to AMapNaviServiceAreaInfo.
 */
- (void)driveManager:(AMapNaviDriveManager *)driveManager updateServiceAreaInfos:(nullable NSArray<AMapNaviServiceAreaInfo *> *)serviceAreaInfos;