Code example for LocationRequest

Methods: setFastestIntervalsetIntervalsetPriority

2
		if (servicesConnected()) { 
			locationClient = new LocationClient(activity, this, this);
 
			locationRequest = LocationRequest.create();
			// Use high accuracy 
			locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
			// Set the update interval to 5 seconds 
			locationRequest.setInterval(UPDATE_INTERVAL);
			// Set the fastest update interval to 1 second 
			locationRequest.setFastestInterval(FASTEST_INTERVAL);
		} 
	} 
	 
	private boolean servicesConnected() { 
		// Check that Google Play services is available 
		int resultCode = GooglePlayServicesUtil
				.isGooglePlayServicesAvailable(activity);
		// If Google Play services is available 
		if (ConnectionResult.SUCCESS == resultCode) {
			// In debug mode, log the status 
			Log.d("Location Updates", "Google Play services is available.");