Code example for LocationManager: Getting continuous location updates

Methods: getBestProvidergetProviderrequestLocationUpdates

0
	public static void init(Context ctx, LocationManager locMgr){
	  
	  //LocationManager locMgr = LocationUtils.getLocationManager(ctx.getMyContext()); 
	  
	  // get low accuracy provider 
	  LocationProvider low=
	    locMgr.getProvider(locMgr.getBestProvider(createCoarseCriteria(),true));
	  
	  // get high accuracy provider 
	  LocationProvider high=
	    locMgr.getProvider(locMgr.getBestProvider(createFineCriteria(), true));
	  
	  // using low accuracy provider... to listen for updates 
	  locMgr.requestLocationUpdates(low.getName(), 0, 0f,
	        new LocationListener() {
	        public void onLocationChanged(Location location) {
	          // do something here to save this new location 
	        } 
	        public void onStatusChanged(String s, int i, Bundle bundle) {
	  
	        } 
	        public void onProviderEnabled(String s) {
	           // try switching to a different provider 
	        } 
	        public void onProviderDisabled(String s) {
	           // try switching to a different provider 
	        } 
	      }); 
	  
	  // using high accuracy provider... to listen for updates 
	  locMgr.requestLocationUpdates(high.getName(), 0, 0f,
	        new LocationListener() {
	        public void onLocationChanged(Location location) {
	          // do something here to save this new location 
	        } 
	        public void onStatusChanged(String s, int i, Bundle bundle) {