Free-Drive Mode
Overview
Intelligent Cruise is a smart guidance mode that provides voice alerts, traffic congestion information, and other relevant traffic data while driving — without requiring a start or destination point, or route calculation.
Usage
1. Set Up Cruise Information Listeners
Register a listener to receive cruise mode data updates.
AMapNavi mAMapNavi = AMapNavi.getInstance(mContext);
// Register the cruise mode data listener
mAMapNavi.addAimlessModeListener(new AimlessModeListener() {
// Callback for traffic facility updates during cruise
@Override
public void onUpdateTrafficFacility(AMapNaviTrafficFacilityInfo[] infos) {
}
// Callback for electronic eye (speed camera) updates during cruise
@Override
public void onUpdateAimlessModeElecCameraInfo(AMapNaviTrafficFacilityInfo[] cameraInfo) {
}
// Callback for cruise statistics updates
@Override
public void updateAimlessModeStatistics(AimLessModeStat aimLessModeStat) {
}
// Callback for congestion information updates during cruise
@Override
public void updateAimlessModeCongestionInfo(AimLessModeCongestionInfo aimLessModeCongestionInfo) {
}
});2. Start / Stop Cruise
Use the startAimlessMode and stopAimlessMode methods of the AMapNavi navigation manager to control cruise mode.
/**
* Starts cruise mode.
* Sets the type of smart announcements to play while in cruise mode (no route planned).
*
* @param aimlessMode 1: Announce electronic eyes only
* 2: Announce special road sections only
* 3: Announce both electronic eyes and special road sections
* @since 1.8.0
*/
@Override
public void startAimlessMode(int aimlessMode);
/**
* Stops cruise mode.
*
* @since 1.8.0
*/
@Override
public void stopAimlessMode();Important Notes
1. Cruise mode requires an active network connection.
2. The cruise experience is best tested during actual driving.
3. Cruise mode and navigation mode are mutually exclusive and cannot be used simultaneously.
* If you are currently in navigation mode and want to start cruise mode, you must first call AMapNavi.stopNavi() to stop navigation, then call AMapNavi.startAimlessMode().
* If you are currently in cruise mode and want to start navigation, you must first call AMapNavi.stopAimlessMode() to stop cruise, then start navigation.
Next Steps
To visualize your cruise position on a map and see your cruise status in real time, create a MapView object, add a Marker to the map, and update the marker's coordinates using the vehicle position obtained from the onLocationChange callback. For a complete example, refer to the "Intelligent Cruise" sample in the official SDK demo.