0
在我的應用程序中,我使用位置管理器來獲取經度和緯度。但漫遊到地圖位置的「連接」不會立即與最近的位置「連接」。有時在它工作之前最多需要五次重啓。其他時間需要更多。Android中的位置管理器和速度?
下面是我在做什麼,
LocationManager locationManager;
String context = Context.LOCATION_SERVICE;
locationManager = (LocationManager)getSystemService(context);
String provider = LocationManager.GPS_PROVIDER;
Location location =locationManager.getLastKnownLocation(provider);
updateWithNewLocation(location);
myLocationManager = (LocationManager)getSystemService(
Context.LOCATION_SERVICE);
myLocationListener = new MyLocationListener();
myLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,myLocationListener);
而且在onLocationChanged
double Lat = argLocation.getLatitude();
double Long = argLocation.getLongitude();
Longitude = Double.toString(Long);
Latitude = Double.toString(Lat);
我做錯了嗎?
您可以改述「地圖位置的連接沒有立即與最近位置連接」。 ?你到底什麼意思 ?你的位置監聽器onLocationChanged沒有踢入嗎? – ddewaele 2011-03-24 14:53:07
@ddewaele我得到的GPS位置,但漫遊時,它不反映最近的位置,所以我的應用程序的要求是獲得最近的位置提供緊急服務。 – Panache 2011-03-24 15:00:54