在谷歌地图Android上追踪路线
我想开发一个Android应用程序,在谷歌地图上跟踪我的路线。有可能吗?如果有,请告诉我API和任何示例代码链接是什么?遵循此链接并保存所有经纬度值以跟踪位置 使用api获取方向在谷歌地图Android上追踪路线,android,google-maps,Android,Google Maps,我想开发一个Android应用程序,在谷歌地图上跟踪我的路线。有可能吗?如果有,请告诉我API和任何示例代码链接是什么?遵循此链接并保存所有经纬度值以跟踪位置 使用api获取方向 "http://maps.googleapis.com/maps/api/directions/json?" + "origin=" + start.latitude + "," + start.longitude + "&destination=
"http://maps.googleapis.com/maps/api/directions/json?"
+ "origin=" + start.latitude + "," + start.longitude
+ "&destination=" + end.latitude + "," + end.longitude
+ "&sensor=false&units=metric&mode=driving";
或
如果您只想跟踪位置,请使用
public void onLocationChanged(Location location) {
if (lastLocationloc == null) {
lastLocationloc = location;
}
//public void setPoints (List<LatLng> points)
LatLng LatLng_origin = new LatLng( 13.133333, 78.133333); //kolar
LatLng LatLng3 = new LatLng(21.4949767, 86.942657999); // bbsr
TextView tvLocation = (TextView) findViewById(R.id.add);
double latitude = location.getLatitude();
double longitude = location.getLongitude();
LatLng latLng = new LatLng(latitude, longitude);
googleMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
googleMap.animateCamera(CameraUpdateFactory.zoomTo(10));
tvLocation.setText("Latitude:" + latitude + ", Longitude:" + longitude);
}
public void onLocation已更改(位置){
如果(lastLocationloc==null){
lastLocationloc=位置;
}
//公共无效设定点(列表点)
LatLng LatLng_origin=新LatLng(13.13333,78.13333);//科拉尔
LatLng LatLng3=新LatLng(21.4949767,86.942657999);//bbsr
TextView tvLocation=(TextView)findViewById(R.id.add);
双纬度=location.getLatitude();
double longitude=location.getLongitude();
LatLng LatLng=新LatLng(纬度、经度);
googleMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
googleMap.animateCamera(CameraUpdateFactory.zoomTo(10));
tvLocation.setText(“纬度:+纬度+”,经度:+经度);
}
还有什么疑问吗