常量名 | 说明 |
---|---|
ROUTE_PLAN_PREFERENCE_DEFAULT | 默认,智能推荐 |
ROUTE_PLAN_PREFERENCE_NOHIGHWAY | 少走高速 |
ROUTE_PLAN_PREFERENCE_NOTOLL | 少收费 |
ROUTE_PLAN_PREFERENCE_AVOID_TRAFFIC_JAM | 躲避拥堵 |
ROUTE_PLAN_PREFERENCE_DISTANCE_FIRST | 距离最短,距离优先 |
ROUTE_PLAN_PREFERENCE_TIME_FIRST | 时间最短,时间优先 |
ROUTE_PLAN_PREFERENCE_ROAD_FIRST | 大路优先,高速优先 |
ROUTE_PLAN_PREFERENCE_ECONOMIC_ROUTE | 省钱路线(货车专用) |
List<BNRoutePlanNode> list = new ArrayList<>();BNRoutePlanNode startNode = new BNRoutePlanNode.Builder().longitude(116.397609).latitude(39.908560).build()BNRoutePlanNode endNode = new BNRoutePlanNode.Builder().longitude(116.306333).latitude(40.041690).build()list.add(startNode);list.add(endNode);BaiduNaviManagerFactory.getRoutePlanManager().routePlan(list,IBNRoutePlanManager.RoutePlanPreference.ROUTE_PLAN_PREFERENCE_DEFAULT,bundle, handler);
List<BNRoutePlanNode> list = new ArrayList<>();BNRoutePlanNode startNode = new BNRoutePlanNode.Builder().longitude(116.397609).latitude(39.908560).build();BNRoutePlanNode viaNode = new BNRoutePlanNode.Builder().longitude(116.386333).latitude(40.042690).build()BNRoutePlanNode endNode = new BNRoutePlanNode.Builder().longitude(116.306333).latitude(40.041690).build();list.add(startNode);list.add(viaNode);list.add(endNode);BaiduNaviManagerFactory.getRoutePlanManager().routePlan(list,IBNRoutePlanManager.RoutePlanPreference.ROUTE_PLAN_PREFERENCE_DEFAULT,bundle, handler);
BaiduNaviManagerFactory.getCommonSettingManager().setViaPointCount(10)
// 驾车车牌设置BaiduNaviManagerFactory.getCommonSettingManager().setCarNum("沪FTP939",IBNOuterSettingParams.CarPowerType.Normal);
private Handler handler = new Handler(Looper.getMainLooper()) {@Overridepublic void handleMessage(@NonNull Message msg) {switch (msg.what) {case IBNRoutePlanManager.MSG_NAVI_ROUTE_PLAN_START:Toast.makeText(DemoMainActivity.this, "算路开始", Toast.LENGTH_SHORT).show();break;case IBNRoutePlanManager.MSG_NAVI_ROUTE_PLAN_SUCCESS:Toast.makeText(DemoMainActivity.this, "算路成功", Toast.LENGTH_SHORT).show();break;case IBNRoutePlanManager.MSG_NAVI_ROUTE_PLAN_FAILED:Toast.makeText(DemoMainActivity.this.getApplicationContext(),"算路失败", Toast.LENGTH_SHORT).show();break;case IBNRoutePlanManager.MSG_NAVI_ROUTE_PLAN_TO_NAVI:Toast.makeText(DemoMainActivity.this.getApplicationContext(),"算路成功准备进入导航", Toast.LENGTH_SHORT).show();break;}}};
上一篇
下一篇
本篇文章对您是否有帮助?