Document Navigation SDK for iOS Guides Turn-by-Turn Navigation Free-Drive Mode

Free-Drive Mode

Overview

Intelligent Cruise is a smart guidance mode that provides voice alerts and traffic congestion information while driving, without requiring a start or end point or route calculation.

Important:

1. Cruise mode requires an active network connection.

2. For the best experience, test cruise mode during actual driving.

3. Cruise mode and navigation mode are mutually exclusive and cannot be used simultaneously.

* To switch from navigation mode to cruise mode, first call AMapNaviDriveManager.stopNavi to stop navigation, then set AMapNaviDriveManager.detectedMode to the desired cruise mode.

* To switch from cruise mode to navigation mode, first set AMapNaviDriveManager.detectedMode to AMapNaviDetectedModeNone to disable cruise mode, then start navigation.

Usage

Follow these steps to implement Intelligent Cruise:

Step 1: Create an AMapNaviDriveManager Instance

- (void)initDriveManager
{
   [[AMapNaviDriveManager sharedInstance] setDelegate:self];
        
   [[AMapNaviDriveManager sharedInstance] setAllowsBackgroundLocationUpdates:YES];
   [[AMapNaviDriveManager sharedInstance] setPausesLocationUpdatesAutomatically:NO];
}

Step 2: Enable Cruise Mode

Call the setDetectedMode method of AMapNaviDriveManager to enable Intelligent Cruise.

Three cruise modes are available:

Mode

Description

AMapNaviDetectedModeCamera

Returns electronic eye (speed camera) information during cruise.

AMapNaviDetectedModeSpecialRoad

Returns special road facility information during cruise.

AMapNaviDetectedModeCameraAndSpecialRoad

Returns both electronic eye and special road facility information during cruise.

The following example shows how to enable cruise mode:

// Enable Intelligent Cruise mode
[[AMapNaviDriveManager sharedInstance] setDetectedMode:AMapNaviDetectedModeCameraAndSpecialRoad];

Step 3: Receive Cruise Statistics

When the vehicle's location changes during cruise, the updateCruiseInfo callback is triggered, providing the continuous driving distance and continuous elapsed time.

The following example shows how to handle this callback:

- (void)driveManager:(AMapNaviDriveManager *)driveManager updateCruiseInfo:(AMapNaviCruiseInfo *)cruiseInfo
{
    NSLog(@"updateCruiseInfo:%@", cruiseInfo);
}

Step 4: Receive Road Facility Data

When an electronic eye or special road facility is detected during cruise, the updateTrafficFacilities callback is triggered. The AMapNaviTrafficFacilityInfo object provides information about the road traffic facility, such as its type and the remaining distance to it.

The following example shows how to handle this callback:

- (void)driveManager:(AMapNaviDriveManager *)driveManager updateTrafficFacilities:(NSArray<AMapNaviTrafficFacilityInfo *> *)trafficFacilities
{
    NSLog(@"updateTrafficFacilities:%@", trafficFacilities);
}

Additional Information

1. To display your cruise position on a map in real time and visualize your cruise status, create an MAMapView object, add annotations to the map, and update the annotation coordinates using the vehicle's position from the updateNaviLocation callback. For a complete implementation, refer to the "Intelligent Cruise" example in the official Demo.

2. To disable cruise mode, call:

[[AMapNaviDriveManager sharedInstance] setDetectedMode:AMapNaviDetectedModeNone];