我使用 LocationManager 来获取位置。然后将位置转换为 GeoPoint 并在地图中显示。为什么它与谷歌地图显示位置如此不同?这是获取位置的方法:
mLocationManager = (LocationManager)this.getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE);
criteria.setAltitudeRequired(false);
criteria.setBearingRequired(false);
criteria.setCostAllowed(true);
criteria.setPowerRequirement(Criteria.POWER_LOW);
final String strLocationProvider = mLocationManager.getBestProvider(criteria, true);
mLocationManager.requestLocationUpdates(strLocationProvider, 1000, 0,
new LocationListener(){
@Override
public void onLocationChanged(Location location) {
// TODO Auto-generated method stub
double geoLatitude = mLocation.getLatitude()*1E6;
double geoLongitude = mLocation.getLongitude()*1E6;
GeoPoint currentGeoPoint = new GeoPoint((int)geoLatitude,(int)geoLongitude);
mapCon.animateTo(currentGeoPoint); }
@Override
public void onProviderDisabled(String provider) {
// TODO Auto-generated method stub
}
@Override
public void onProviderEnabled(String provider) {
// TODO Auto-generated method stub
}
@Override
public void onStatusChanged(String provider, int status,
Bundle extras) {
// TODO Auto-generated method stub
}
});