0

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) {

            /***/

}

}
yturgun
  • 183
  • 1
  • 2
  • 10
  • You probobly need to move a long way (> 1km) for the non Gps location to spot any change. How far did you move? – Ifor Feb 13 '13 at 09:52
  • Not much really, but didn't it has to give a first fix at start? Or do i have to use another way for the first fix before onLocationChanged? – yturgun Feb 13 '13 at 15:23
  • I use getLastKnowenLocation or something like that on LocationManager manager to initalise a value. – Ifor Feb 13 '13 at 16:23
  • I was using getlastfix but sometimes it returns null when getLastKnownLocation is not, so i made a methot which checks getlastfix, getlastknownlocation both gps and network, it's ok for me now. – yturgun Feb 18 '13 at 19:54
  • Thanks Ifor write your post as an answer please. – yturgun Feb 18 '13 at 19:55

0 Answers0