when i am try to get latitude and longitude from network provider in kitkat the onLocationChanged method is not working. My code is:
double dlat,dlang;
listener = new MyLocationListener();
locationManager = (LocationManager)context. getSystemService(Context.LOCATION_SERVICE);
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 1000,100, listener);
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 100, listener);
public class MyLocationListener implements LocationListener
{
public void onLocationChanged(final Location loc)
{
dlat = loc.getLatitude();
dlang = loc.getLongitude();
}
}
}