I am using MyLocationOverlay to display the current location. However, it takes a while for the location to get updated. I wanted to implement something like the "follow me" feature on iPhone wherein the location of the user is also moving as the user moves. How can I make the marker of MyLocationOverlay to perform live update on its location?
Please note that I override the draw() and drawMyLocation() because I need to draw a custom marker.
My current code looks like this: (The problem with my code is that the marker does not move along with the user. Since it takes a while before onLocationChanged is called, the marker will just suddenly jump from one place to another.)
@Override
public synchronized void onLocationChanged(Location location)
{
if (location != null && mapController != null)
{
//Recenter map based on current location
mapController.animateTo(new GeoPoint((int) (location.getLatitude() * 1e6), (int) (location.getLongitude() * 1e6)));
}
super.onLocationChanged(location);
}