내 앱에는 현재 위치의 좌표를 가져온 다음 좌표를 지정한 대상까지의 경로를 보여주는 활동이 포함됩니다. 문제는지도를로드하고 경로를 얻는 데 몇 시간이 걸리는 것입니다. 누구든지 나에게 더 빠른 속도로 해달라고 제안 할 수있다. 그리고지도 기능을 얻기 위해 모바일에있는지도 애플리케이션을 사용하고있다. 다음은 내가지도가 매우 천천히로드됩니다.
package com.map;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.net.Uri;
import android.os.Bundle;
import android.widget.Toast;
public class MapRouteActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
LocationManager mlocManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
LocationListener mlocListener = new MyLocationListener();
mlocManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, mlocListener);
mlocManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, mlocListener);
}
public class MyLocationListener implements LocationListener
{
public void onLocationChanged(Location loc)
{
loc.getLatitude();
loc.getLongitude();
String Text = "My current location is: " + "Latitud = " + loc.getLatitude() +"Longitud = " + loc.getLongitude();
Toast.makeText(getApplicationContext(),Text,Toast.LENGTH_SHORT).show();
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("http://maps.google.com/maps?saddr="+loc.getLatitude()+","+loc.getLongitude()+"&daddr=18.5204303,73.8567437"));
startActivity(intent);
}
@Override
public void onProviderDisabled(String provider)
{
Toast.makeText(getApplicationContext(),"Gps Disabled",Toast.LENGTH_SHORT).show();
}
@Override
public void onProviderEnabled(String provider)
{
Toast.makeText(getApplicationContext(),"Gps Enabled",Toast.LENGTH_SHORT).show();
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras)
{
}
}
}
어떻게 하시겠습니까? 좋은 인터넷 연결로 MapView를 사용한다면 몇 초 밖에 걸리지 않습니다. – Reno
안녕하세요, 리노,지도를 그리기 위해 inbuilt지도 애플리케이션을 사용하고 있습니다. – amithotu
코드를보고 발사 시간이 오래 걸리는 이유를 알려주십시오. – amithotu