Android程序调用本机googlemap,传递起始和终点位置,生成路线图
Android程序调用本机googlemap,传递起始和终点位置,生成路线图

if (wodeweizhiPoint != null) {
        if (wodeweizhiPoint.getLatitudeE6() != 0) {
		float chufajingdu = (float) (wodeweizhiPoint.getLongitudeE6() / 1E6);
		float chufaweidu = (float) (wodeweizhiPoint.getLatitudeE6() / 1E6);
		float daodajingdu = (float) (AppConstant.PointZuoBiao.liangxiangDaoHangPoint.getLongitudeE6() / 1E6);
		float daodaweidu = (float) (AppConstant.PointZuoBiao.liangxiangDaoHangPoint.getLatitudeE6() / 1E6);
		// 标记一个点
		// Intent i = new
		// Intent(Intent.ACTION_VIEW,Uri.parse("http://ditu.google.cn/maps?hl=zh&mrt=loc&q=31.249351,121.45905"));
					
		// 从哪到哪的路线
		Intent i = new Intent(Intent.ACTION_VIEW,Uri.parse("http://ditu.google.cn/maps?f=d&source=s_d&saddr="
					                        + chufaweidu
							        + ","
								+ chufajingdu
								+ "&daddr="
								+ daodaweidu
								+ ","
								+ daodajingdu + "&hl=zh"));
		//如果强制使用googlemap地图客户端打开,就加下面两句
		i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK& Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
		i.setClassName("com.google.android.apps.maps","com.google.android.maps.MapsActivity");
                startActivity(i);
	}
} else {
       AlertUtils.ToastAlert(mContext, “由于无法获取到您的位置,所以暂时无法提供导航”);
}

相关文章:

  • 2022-12-23
  • 2021-11-26
  • 2022-01-12
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
  • 2021-11-26
猜你喜欢
  • 2022-12-23
  • 2021-11-29
  • 2022-12-23
  • 2021-11-07
  • 2022-12-23
  • 2022-12-23
  • 2021-06-26
相关资源
相似解决方案