LocationDisplayManager lDisplayManager = null;
lDisplayManager = mMapView.getLocationDisplayManager();
lDisplayManager.setAutoPanMode(LocationDisplayManager.AutoPanMode.OFF);
lDisplayManager.setLocationListener(new LocationListener() {
@Override
public void onLocationChanged(Location location) {
double locy = location.getLatitude();
double locx = location.getLongitude();
SetMyLocationPoint(locx, locy);
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
@Override
public void onProviderEnabled(String provider) {
}
@Override
public void onProviderDisabled(String provider) {
}
});
Using the above code i was able to retrieve users current location and display it on Map . Its works perfectly , the problem comes in when user moves from one location to another location , the map also gets updated . In my application scenario the location are meant to be fetched only one time when use hits the LOCATE ME button where as there is no need to get continues location from user .
I did tried following codes
this.lDisplayManager.stop();
mMapView.getLocationDisplayManager().stop();
lDisplayManager.setLocationListener(null);
Above code works but i have to call them manually to stop continues location updates . Is there any alternative way to fetch location only single time instead of continues .