1
내 응용 프로그램에서 운전 경로를 설정하고 GPS 추적을 시작합니다. 빨간색으로 움직이는 위치 색상. Google지도 방향 API를 사용하고 있습니다. 방향 경로를 설정하려면 정상적으로 작동합니다. 그러나 GPS 추적 기능이 작동하지 않습니다.구글 안드로이드에서 구글 방향 API를 사용하여 추적
gps 및 gps 추적 경로 색상을 사용 설정하는 방법은 무엇입니까? 여기
내 코드입니다 :public class MainActivity extends MapActivity implements LocationListener {
private static final String Location = null;
public MapView mapView ;
public List<GeoPoint> geoPointsArray = new ArrayList<GeoPoint>();
private LocationManager lm;
private LogOverlay logOverlay;
private GpsLog log;
double lat;
double lon;
public GeoPoint srcGeoPoint,destGeoPoint,interGeoPoint;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
System.out.println("*************1**************1");
setContentView(R.layout.activity_main);
System.out.println("*************2**************");
mapView = (MapView) findViewById(R.id.mapv);
mapView.setBuiltInZoomControls(true);
System.out.println("*************3**************");
lm = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 20000, 10,this);
double src_lat = 12.98472; // the testing source
double src_long = 80.17778;
double dest_lat = 13.00833; // the testing destination
double dest_long =80.2125;
double via_lat = 13.065; // the testing destination
double via_long = 80.2325;
srcGeoPoint = new GeoPoint((int) (src_lat * 1E6),
(int) (src_long * 1E6));
destGeoPoint = new GeoPoint((int) (dest_lat * 1E6),
(int) (dest_long * 1E6));
interGeoPoint = new GeoPoint((int) (via_lat * 1E6),
(int) (via_long * 1E6));
mapView.getController().animateTo(srcGeoPoint);
mapView.getController().setZoom(15);
new LongOperation().execute("");
initMyLocation();
final MyLocationOverlay overlay = new MyLocationOverlay(this, mapView);
overlay.enableMyLocation();
overlay.enableCompass();
mapView.invalidate();
System.out.println("*************4**************");
}
private void initMyLocation() {
System.out.println("init my location *************");
// does not work in emulator
}
질문의 형식을 올바르게 지정하십시오. –