Navigation Data
[Navinfo Navigation SDK for iOS] provides the corresponding interface to return navigation data, including: current car position (latitude and longitude), current head direction, current speed, current road name, current route length, route remaining time, current steering ID, suggestion The map shows the scale and other data. For specific data, please refer to [Navinfo Navigation SDK for iOS] interface documentation.
(For complete code, see MBNaviController.m in the SDKDemo project) @property (nonatomic ,strong) MBNaviSession*naviSession; // Initialize MBNaviSession naviSession = [MBNaviSession sharedInstance]; // Initialize MBNaviSessionParams MBNaviSessionParams* params = [MBNaviSessionParams defaultParams]; // Whether to automatically start navigation after the road is calculated [default on] params.autoTakeRoute = NO; // Whether to activate the intersection enlargement. Close by default params.enableOnlineJunctionView = YES; // Set navigation related parameters naviSession.params = params; naviSession.delegate = self; naviSession.enableSound = YES; // Set the detailed broadcast mode (go ahead to ****) [naviSession setNaviStartVoiceMode:MBNaviSessionNaviStartVoiceMode_detailed]; // Turn on the camera broadcast [naviSession setEnableCamera:YES]; // Set online/offline calculations [naviSession setNavPreference:MBDataPreference_preferOnline]; // Set the electronic eye broadcast mode [naviSession setCameraMode:MBCamerFilterMode_all]; // Set the voice broadcast mode [naviSession setGuidanceMode:MBGuidanceMode_safe]; // High-speed stroke module working mode [naviSession setHighwayGuidemode:MBHighwayGuideMode_complete]; // Set navigation tmc parameters MBTmcOptions options; // Calculate the path interval (ms) options.rerouteCheckInterval = 1000; // route color update interval (ms) options.routeColorUpdateInterval = 1000; // Whether to open TMC options.enableTmcReroute = NO; // Set TMC related options [naviSession setTmcOptions:options]; // Adopt the specified route, set it as the current route, routeBase, please refer to 9.1 calculation [naviSession takeRoute:_routeBase]; // MBNaviSessionDelegate - (void)naviSessionTracking:(MBNaviSessionData *)sData { NSLog (@"current car location: %d, %d", sData.carPos.x, sData.carPos.y); NSLog (@"current head orientation: %ld", (long) sData.carOri); NSLog (@"current recommended scale: %ld", (long) sData.suggestedMapScale); NSLog (@" Is there a next turn: %@, and %ld meters turn", sData.hasTurn?@"Yes": @"No", (long)sData.turnIconDistance); NSLog(@"current steering ID: %ld", (long)sData.turnIcon); NSLog (@"Road name after turn: %@", sData.nextRoadName); NSLog (@"current road name: %@", sData.roadName); NSLog(@"\n"); }