public void enableFollowLocation ( ) { mIsFollowing = true ; // set initial location when enabled if ( isMyLocationEnabled ( ) ) { Location location = mMyLocationProvider . getLastKnownLocation ( ) ; if ( location != null ) { setLocation ( location ) ; } } // Update the screen to see changes take effect if ( mMapView != null ) { mMapView . postInvalidate ( ) ; } }
Enables follow functionality . The map will center on your current location and automatically scroll as you move . Scrolling the map in the UI will disable .