i have a problem using location listener and location manager.
I'm using class that i found on the Internet
public class MyLocationListener implements LocationListener
{
public void onLocationChanged(Location location) {
home_text.setText("Location Change");
}
public void onStatusChanged(String provider, int status, Bundle extras) {
// TODO Auto-generated method stub
}
public void onProviderDisabled(String provider) {
// TODO Auto-generated method stub
}
public void onProviderEnabled(String provider) {
// TODO Auto-generated method stub
}
}
when i use gps provider, it works fine
locationListener = new MyLocationListener();
locationManager = (LocationManager)getActivity().getSystemService(Context.LOCATION_SERVICE);
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,1000,1, locationListener);
when i use network provider, the onLocationChanged just called once at the start and never called again.
locationListener = new MyLocationListener();
locationManager = (LocationManager)getActivity().getSystemService(Context.LOCATION_SERVICE);
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,1000,1, locationListener);
although, when i open the maps using both method, it still can find my current location and update the maps.
googleMap.setMyLocationEnabled(true);
please help me...