Я использую следующий код, чтобы узнать свое текущее местоположение. Но проблема, с которой я столкнулся, всегда возвращает 0,0 для широты и долготы. Я включил в телефоне настройки GPS и выставил все разрешения. Но все же я сталкиваюсь с этим.
locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
customLocationListener = new CustomLocationListener();
locationManager.requestLocationUpdates(
LocationManager.GPS_PROVIDER,
0,
0,
customLocationListener);
class CustomLocationListener implements LocationListener{ ............
public void onLocationChanged(Location argLocation) {
if(location != null) {
int latitude=(int)(argLocation.getLatitude()*1E6);
int longitude=(int)(argLocation.getLongitude()*1E6);
}
} ........ }
Кто-нибудь из вас знает почему?
Примечание: Моя активность расширяет MapActivity, а не Location Listener