经纬度

标签: 经纬度

android获得当前定位的城市名

首先要从安卓获得经纬度: /** * 获取当前经纬度 */ private void getGPSLocation(){ double latitude = 0.0, longitude = 0.0; LocationManager locationManager = (LocationManager)getSystemService(Context.LOCATIONSERVICE); if(locationManager.isProviderEnabled(LocationManager.GPSPROVIDER)){ Location location = locationManager.getLastKnownLocation(LocationManager.GPSPROVIDER); if(location != null){ latitude = location.getLatitude(); longitude = location.getLongitude(); }else{ LocationListener locationListener = new LocationListener(){ public void onLocationChanged(Location location) {} public void

阅读全文...