Google マップでルートを追跡できる Android アプリケーションを開発したいのですが、可能ですか?可能であれば、API とサンプル コードのリンクを教えてください。
2329 次
1 に答える
-1
このリンク Google Maps Android: How can i draw a route line to see direction & save all the latitude longitude value for tracking the location .
方向を取得するためにAPIを使用する
"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);
}
もう疑いませんか??
于 2013-11-04T11:42:56.760 に答える