Code example for GoogleMap

Methods: setLocationSource, setMyLocationEnabled, setOnMapLongClickListener

0
locationManager.requestLocationUpdates(provider, 20000, 2, this);	
	} 
	 
	private void setUpMap() { 
		mMap.setLocationSource(mLocationSource);
		mMap.setOnMapLongClickListener(mLocationSource);
		mMap.setMyLocationEnabled(true);
	} 
 
	/** 
	 * A {@link LocationSource} which reports a new location whenever a user 
	 * long presses the map at the point at which a user long pressed the map. 
	 */ 
	private static class LongPressLocationSource implements LocationSource,
			OnMapLongClickListener {
		private OnLocationChangedListener mListener;
 
		/** 
		 * Flag to keep track of the activity's lifecycle. This is not strictly 
		 * necessary in this case because onMapLongPress events don't occur