简述
当SDK运行于无法获取卫星信号数据的设备时,可以利用其它卫星定位模块获取卫星定位信息,然后通过SDK提供的接口传入卫星信号数据发起导航。
传入卫星信息
可以调用以下接口传入卫星数据:
//设置为外部卫星导航模式 [BNaviService_Location setGpsFromExternal:YES]; // 传入卫星数据 [BNaviService_Location setCurrentLocation:self.location];
传入外部卫星导航
在导航前需要算路,算路过程请参考路径规划部分,在算路成功后,不断地传入卫星信息,即可发起导航,代码如下:
//算路成功回调 -(void)routePlanDidFinished:(NSDictionary *)userInfo { NSLog(@"算路成功"); //设置为外部卫星导航模式 [BNaviService_Location setGpsFromExternal:YES]; //显示导航UI [BNaviService_UI showNaviUI:BN_NaviTypeReal delegete:self isNeedLandscape:YES]; //开始发送卫星信息 [self.externalGPSModel startPostGPS]; } // self.externalGPSModel的方法,开启定时器不断向SDK抛送卫星信息 - (void)startPostGPS { self.gpsIndex = 0; self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(postGPS) userInfo:nil repeats:YES]; [self.timer fire]; } //抛送卫星信息,其中self.gpsArray是元素为BNLocation的数组 - (void)postGPS { if (!self.gpsArray || self.gpsArray.count == 0 || self.gpsArray.count <= self.gpsIndex) return; [BNaviService_Location setCurrentLocation:self.gpsArray[self.gpsIndex]]; self.gpsIndex = (self.gpsIndex + 1)%self.gpsArray.count; }