Android中调用高德导航(组件)
1 btn_.setOnClickListener(new View.OnClickListener() { 2 @Override 3 public void onClick(View view) { 4 //调用高德APP 5 //https://blog.csdn.net/u013066292/article/details/62246977 6 //不传入起点、途径点、终点启动导航组件 7 //AmapNaviPage.getInstance().showRouteActivity(mContext, new AmapNaviParams(null), MapActivity.this); 8 9 //传入起点、终点启动导航组件示例: 10 Poi start = new Poi("三元桥", new LatLng(39.96087,116.45798), ""); 11 /**终点传入的是北京站坐标,但是POI的ID "B000A83M61"对应的是北京西站,所以实际算路以北京西站作为终点**/ 12 Poi end = new Poi("北京站", new LatLng(39.904556, 116.427231), "B000A83M61"); 13 AmapNaviPage.getInstance().showRouteActivity(mContext, new AmapNaviParams(start, null, end, AmapNaviType.DRIVER), MapActivity.this); 14 } 15 });
实现 INaviInfoCallback 接口
1 @Override 2 public void onInitNaviFailure() { 3 4 } 5 6 @Override 7 public void onGetNavigationText(String s) { 8 9 } 10 11 @Override 12 public void onLocationChange(AMapNaviLocation aMapNaviLocation) { 13 14 } 15 16 @Override 17 public void onArriveDestination(boolean b) { 18 19 } 20 21 @Override 22 public void onStartNavi(int i) { 23 24 } 25 26 @Override 27 public void onCalculateRouteSuccess(int[] ints) { 28 29 } 30 31 @Override 32 public void onCalculateRouteFailure(int i) { 33 34 } 35 36 @Override 37 public void onStopSpeaking() { 38 39 } 40 41 @Override 42 public void onReCalculateRoute(int i) { 43 44 } 45 46 @Override 47 public void onExitPage(int i) { 48 49 } 50 51 @Override 52 public void onStrategyChanged(int i) { 53 54 } 55 56 @Override 57 public View getCustomNaviBottomView() { 58 return null; 59 } 60 61 @Override 62 public View getCustomNaviView() { 63 return null; 64 } 65 66 @Override 67 public void onArrivedWayPoint(int i) { 68 69 }