百度地图Android导航SDK—实时导航中的设备GPS数据进行替换

百度地图Android导航SDK—实时导航中的设备GPS数据进行替换

传入外部GPS数据相当于将实时导航中的设备GPS数据进行了替换,具体步骤如下:

// 开启使用外部GPS数据
BaiduNaviManagerFactory.getBaiduNaviManager().externalLocation(true);
// 传入外部GPS数据,请尽量按以下方式传入数据参数,缺失数据会影响GPS的准确性,造成定位不准。
// 必须使用WGS84坐标系
BNLocationData mLocData = new BNLocationData.Builder()
        .latitude(location.getLatitude())
        .longitude(location.getLongitude())
        .accuracy(location.getAccuracy())
        .speed(location.getSpeed())
        .direction(location.getBearing())
        .altitude((int) location.getAltitude())
        .time(location.getTime())
        .build();
BaiduNaviManagerFactory.getMapManager().setMyLocationData(mLocData);
🚀 如未找到文章请搜索栏搜素 | Ctrl+D收藏本站 | 联系邮箱:15810050733@qq.com