CurrentLocationRequest.Builder

public static final class CurrentLocationRequest.Builder extends Object

A builder for CurrentLocationRequest.

Public Constructor Summary

Builder()
Constructs a new builder with default values.
Builder(CurrentLocationRequest request)
Constructs a new builder with values copied from the given CurrentLocationRequest.

Public Method Summary

CurrentLocationRequest
CurrentLocationRequest.Builder
setDurationMillis(long durationMillis)
Sets the duration in milliseconds of the location request used to derive the current location if no historical location satisfies the current location request.
CurrentLocationRequest.Builder
setGranularity(int granularity)
Sets the Granularity of locations returned for this request.
CurrentLocationRequest.Builder
setMaxUpdateAgeMillis(long maxUpdateAgeMillis)
Sets the maximum age of any location returned for this request.
CurrentLocationRequest.Builder
setPriority(int priority)
Sets the Priority of the location request used to derive the current location if no historical location satisfies the current location request.

Inherited Method Summary

Public Constructors

public Builder ()

Constructs a new builder with default values.

public Builder (CurrentLocationRequest request)

Constructs a new builder with values copied from the given CurrentLocationRequest.

Public Methods

public CurrentLocationRequest build ()

Builds a new CurrentLocationRequest.

public CurrentLocationRequest.Builder setDurationMillis (long durationMillis)

Sets the duration in milliseconds of the location request used to derive the current location if no historical location satisfies the current location request. If this duration expires with no location, the current location request will return a null location.

NOTE: Internally, this duration is capped with what the Fused Location Provider believes is a reasonable maximum duration until it is unlikely that any current location can be derived. This value is currently roughly 30 seconds, but clients should expect this value could change at any time in the future.

The default value is Long.MAX_VALUE.

public CurrentLocationRequest.Builder setGranularity (int granularity)

Sets the Granularity of locations returned for this request. This controls whether fine or coarse locations may be returned.

The default value is Granularity.GRANULARITY_PERMISSION_LEVEL.

public CurrentLocationRequest.Builder setMaxUpdateAgeMillis (long maxUpdateAgeMillis)

Sets the maximum age of any location returned for this request. A value of 0 indicates that only freshly derived locations will be returned, and no historical locations will ever be returned. A value Long.MAX_VALUE represents an effectively unbounded maximum age.

NOTE: This parameter applies only to historical locations. Freshly derived locations should almost always have timestamps close to the present time - however it is possible under unlikely conditions for location derivation to take longer than expected, in which case freshly derived locations may have slightly older timestamps.

The default value is 10 seconds. Do not rely on the default value always being 10 seconds as this may change without notice.

public CurrentLocationRequest.Builder setPriority (int priority)

Sets the Priority of the location request used to derive the current location if no historical location satisfies the current location request.

The default value is Priority.PRIORITY_BALANCED_POWER_ACCURACY.