Developer Guide
Get a License
Contact your sales representative to obtain a license.
Set Up License Device Authentication
License Callback Interface
/// Callback for device license authorization.
///
/// - Parameters:
/// - success: Whether authorization succeeded.
/// - error: Reason for failure.
- (void)deviceLicenseAuth:(BOOL)success error:(nullable NSError *)error {
NSLog(@"License auth result: %d, error: %@", success, error);
if (error) {
return;
}
}
- (void)licenseTerminalAuthResult:(int)errorCode errmsg:(NSString *)msg {
NSLog(@"License terminal auth result: %d, msg: %@", errorCode, msg);
if (errorCode == 1) {
[self startCalRoute];
}
}LicenseManager Methods
/**
* Sets device authentication information. Devices that fail authentication
* will have limited functionality. Unbound terminal-device pairs are
* automatically bound.
*
* @param licenseId License ID
* @param deviceId Unique device (head unit) ID
* @param terminalId Unique terminal (phone) ID
*/
- (void)setupLicense:(NSString *)licenseId deviceId:(NSString *)deviceId terminalId:(NSString *)terminalId;Usage
1. Call AMapLicenseManager.shareManager() to obtain the LicenseManager singleton.
2. Call AMapLicenseManager.setupLicense to request authentication. Paid features are only available after successful authentication.
For navigation SDK usage, please refer to the official website.
Screen Projection — Background Rendering
The background rendering SDK addresses the issue where iOS disables GPU calls when the screen is off during two-wheeler screen projection scenarios, preventing standard map rendering. This SDK uses map vector road network data and the iOS CoreGraphics framework to render the map by capturing screenshots at timed intervals.
self.updateViewTimer = [NSTimer scheduledTimerWithTimeInterval:1.0/self.maxRenderFrame repeats:YES block:^(NSTimer * _Nonnull timer) {
[weakSelf updateImage];
}];
[[NSRunLoop mainRunLoop] addTimer:self.updateViewTimer forMode:NSRunLoopCommonModes];
self.panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
[self.imageView addGestureRecognizer:self.panGesture];
- (void)updateImage {
UIImage *image = [self.mapView renderImage];
self.imageView.image = image;
if (self.session.connectedPeers.count > 0) {
[self sendImage:image];
}
}
- (void)handlePan:(UIPanGestureRecognizer *)gesture {
if (gesture != self.panGesture) {
return;
}
if (gesture.state == UIGestureRecognizerStateBegan) {
self.panStartPoint = [gesture translationInView:self.imageView];
NSLog(@"panStartPoint: %@", NSStringFromCGPoint(self.panStartPoint));
} else if (gesture.state == UIGestureRecognizerStateEnded) {
CGPoint endPoint = [gesture translationInView:self.imageView];
NSLog(@"panEndPoint: %@", NSStringFromCGPoint(endPoint));
CGSize mapSize = self.imageView.frame.size;
CGPoint anchor = self.mapView.screenAnchor;
CGPoint newCenter = CGPointMake(mapSize.width * anchor.x - (endPoint.x - self.panStartPoint.x),
mapSize.height * anchor.y - (endPoint.y - self.panStartPoint.y));
CLLocationCoordinate2D centerCoord = [self.mapView convertMapScreenPointToCoordinate:newCenter];
[self.mapView setCenterCoordinate:centerCoord];
}
}Simple Network Road Network Rendering
Enable road network mode to render only the map background and road network, hiding POIs, buildings, navigation controls, and other UI elements. When road network mode is enabled, all navigation-related components are hidden internally.
MAMapView *mapview = [self internalMapView];
[mapview setRouteMode:YES];
/// Sets road network mode. When enabled, only the road network is rendered.
/// - Parameter routeMode: Whether to enable road network mode.
- (void)setRouteMode:(BOOL)routeMode;Set the Background Color
[_render.mapService setMapBackgroundColorRed:color.r green:color.g blue:color.b alpha:color.a];