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