Document Navigation SDK for iOS Guides Route Planning Electric Bike Routing

Electric Bike Routing

Overview

Starting with Navigation SDK v8.0.0, electric bike route planning and navigation are fully supported. To use this feature, you must work with the AMapNaviEleBikeManager class.

Important: Electric bike route planning is a paid service. Whether you are requesting a trial or applying for production use, please submit a business cooperation ticket through the ticket system. Otherwise, route calculation will fail by default.

To implement electric bike route planning, you need to understand the following three classes:

AMapNaviEleBikeManager — The electric bike navigation manager class. It provides methods for route planning, pre-trip route selection, and rerouting during navigation.  

Note: Starting with Navigation SDK v8.0.0, the init method of AMapNaviEleBikeManager is deprecated. Use the singleton [AMapNaviEleBikeManager sharedInstance] instead. When the class's dealloc function is called, or at an appropriate time (such as when the navigation view controller is popped), call [AMapNaviEleBikeManager destroyInstance] to destroy the singleton. If the singleton is not destroyed successfully, check whether it is strongly referenced.

<AMapNaviEleBikeManagerDelegate> — The electric bike navigation manager delegate protocol. It provides callback interfaces for events during route calculation and navigation, such as route planning success/failure, TTS strings, weak GPS signal, and arrival at the destination.

<AMapNaviEleBikeDataRepresentable> — The electric bike navigation data protocol. It provides callback interfaces for real-time data during route calculation and navigation, such as guidance information (NaviInfo) and positioning information.

Notes

- Route planning requires a network connection.

- You can obtain the start and end points in several ways, for example:

- Use the coordinate picker to query the coordinates of a desired point.

- Use the POI search in the Search SDK to find points of interest as start or end points.

- Three methods are available for electric bike route planning, as shown in the table below:

Method

Parameter Description

Return Value

Description

calculateEleBikeRouteWithEndPoint:

endPoint: Endpoint coordinate

BOOL — Indicates whether the route planning prerequisites and parameter validation succeeded, not whether the route calculation itself succeeded.

Route planning with only an endpoint (longitude/latitude). The current location is used as the start point internally.

calculateEleBikeRouteWithStartPoint:endPoint:

startPoint: Start point coordinate<br>endPoint: Endpoint coordinate

BOOL — Same as above.

Route planning with both start and end points as longitude/latitude coordinates.

calculateEleBikeRouteWithStartPOIInfo:endPOIInfo:strategy:

startPOIInfo: Start point POIInfo<br>endPOIInfo: Endpoint POIInfo<br>strategy: Route calculation strategy

BOOL — Same as above.

Route planning with both start and end points as POIInfo objects. The start point can be nil; the current location is used as the start point internally.

Recommendation: Use the -calculateEleBikeRouteWithStartPOIInfo:endPOIInfo:strategy: method for route planning. The SDK automatically completes other information based on the POIId or startPOIInfo.startAngle, resulting in a more reasonable route and reducing detours.

Usage

Step 1: Set the Start and End Points

// Initialize start and end points using POI
self.startPOIInfo = [[AMapNaviPOIInfo alloc] init];
self.startPOIInfo.mid = @"B0FFFAB6J2";

self.endPOIInfo = [[AMapNaviPOIInfo alloc] init];
self.endPOIInfo.mid = @"B0FFIA9OE8";

Step 2: Calculate the Route

// Calculate the electric bike route using POI
[[AMapNaviEleBikeManager sharedInstance] calculateEleBikeRouteWithStartPOIInfo:self.startPOIInfo
                                                                   endPOIInfo:self.endPOIInfo
                                                                     strategy:AMapNaviTravelStrategyMultipleDefault];

Step 3: Handle the Result

When the electric bike route calculation succeeds, the -rideManagerOnCalculateRouteSuccess: callback is triggered. In this callback, you can display the planned route or start navigation directly.

- (void)rideManagerOnCalculateRouteSuccess:(AMapNaviRideManager *)rideManager
{
    NSLog(@"onCalculateRouteSuccess");
    // Display the route or start navigation
}