Android calls google map to generate the roadmap implementation code
- 2020-05-09 19:18:01
- OfStack
The Android program calls native googlemap, passes the start and end locations, and generates a roadmap
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);
// tag 1 A point
// Intent i = new
// Intent(Intent.ACTION_VIEW,Uri.parse("http://ditu.google.cn/maps?hl=zh&mrt=loc&q=31.249351,121.45905"));
// The route from where to where
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"));
// If you force it googlemap When the map client opens, add the following two sentences
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, "Unable to obtain your location, so temporarily unable to provide navigation" );
}