OnLocationChanged method not called in MyLocationOverlay when Gps is Off

408 views Asked by At

On the documantation it says mylocationoverlay onlocationchanged method uses both gps and network provider when ACCESS_FINE_LOCATION permission defined. When Gps is on everything is fine, onlocationchanged working but when i close gps onlocationchanged never called. Is there any problem in my class? Do i have to implement locationlistener or locationmanager?

import android.content.Context;
import android.location.Location;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapView;
import com.google.android.maps.MyLocationOverlay;
import com.google.android.maps.Overlay;

public class FLOverlay extends MyLocationOverlay {

public FLOverlay(Context context, MapView mapView) {
    super(context, mapView);

    enableCompass();
    enableMyLocation();
}

@Override           
public synchronized void onLocationChanged(Location location) {

     /***/
}

@Override
public boolean onTap(GeoPoint p, MapView map) {

            /***/

}

}
0

There are 0 answers