# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Ctors | Methods | Inherited Methods

# LocationRequest.Builder

`public static final class LocationRequest.Builder`
`extends Object` ``

java.lang.Object
↳ | android.location.LocationRequest.Builder

A builder class for `LocationRequest`.

## Summary

### Public constructors
`Builder(long intervalMillis)` Creates a new Builder with the given interval.
`Builder(LocationRequest locationRequest)` Creates a new Builder with all parameters copied from the given location request.

### Public methods
`LocationRequest` | `build()` Builds a location request from this builder.
`LocationRequest.Builder` | `clearMinUpdateIntervalMillis()` Clears an explicitly set minimum update interval and reverts to an implicit minimum update interval (ie, the minimum update interval is some sensible default between 0 and the interval).
`LocationRequest.Builder` | `setDurationMillis(long durationMillis)` Sets the duration this request will continue before being automatically removed.
`LocationRequest.Builder` | `setIntervalMillis(long intervalMillis)` Sets the request interval.
`LocationRequest.Builder` | `setMaxUpdateDelayMillis(long maxUpdateDelayMillis)` Sets the maximum time any location update may be delayed, and thus grouped with following updates to enable location batching.
`LocationRequest.Builder` | `setMaxUpdates(int maxUpdates)` Sets the maximum number of location updates for this request before this request is automatically removed.
`LocationRequest.Builder` | `setMinUpdateDistanceMeters(float minUpdateDistanceMeters)` Sets the minimum update distance between location updates.
`LocationRequest.Builder` | `setMinUpdateIntervalMillis(long minUpdateIntervalMillis)` Sets an explicit minimum update interval.
`LocationRequest.Builder` | `setQuality(int quality)` Sets the request quality.

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.

## Public constructors

### Builder

    public Builder (long intervalMillis)

Creates a new Builder with the given interval. See `setIntervalMillis(long)` for more information on the interval.

Parameters
`intervalMillis` | `long`

### Builder

    public Builder (LocationRequest locationRequest)

Creates a new Builder with all parameters copied from the given location request.

Parameters
`locationRequest` | `LocationRequest`: This value cannot be `null`.

## Public methods

### build

    public LocationRequest build ()

Builds a location request from this builder. If an explicit minimum update interval is set, the minimum update interval of the location request will be the minimum of the interval and minimum update interval.

If building a passive request then you must have set an explicit minimum update interval.

Returns
`LocationRequest` | a new location request This value cannot be `null`.

Throws
`IllegalStateException` | if building a passive request with no explicit minimum update interval set

### clearMinUpdateIntervalMillis

    public LocationRequest.Builder clearMinUpdateIntervalMillis ()

Clears an explicitly set minimum update interval and reverts to an implicit minimum update interval (ie, the minimum update interval is some sensible default between 0 and the interval).

Returns
`LocationRequest.Builder` | This value cannot be `null`.

### setDurationMillis

    public LocationRequest.Builder setDurationMillis (long durationMillis)

Sets the duration this request will continue before being automatically removed. Defaults to `Long.MAX_VALUE`, which represents an unlimited duration.

Parameters
`durationMillis` | `long`: Value is 1 or greater

Returns
`LocationRequest.Builder` | This value cannot be `null`.

### setIntervalMillis

    public LocationRequest.Builder setIntervalMillis (long intervalMillis)

Sets the request interval. The request interval may be set to `LocationRequest.PASSIVE_INTERVAL` which indicates this request will not actively generate location updates (and thus will not be power blamed for location), but may receive location updates generated as a result of other location requests. A passive request must always have an explicit minimum update interval set.

Locations may be available at a faster interval than specified here, see `setMinUpdateIntervalMillis(long)` for the behavior in that case.

Parameters
`intervalMillis` | `long`: Value is 0 or greater

Returns
`LocationRequest.Builder` | This value cannot be `null`.

### setMaxUpdateDelayMillis

    public LocationRequest.Builder setMaxUpdateDelayMillis (long maxUpdateDelayMillis)

Sets the maximum time any location update may be delayed, and thus grouped with following updates to enable location batching. If the maximum update delay is equal to or greater than twice the interval, then location providers may provide batched results. Defaults to 0, which represents no batching allowed.

Parameters
`maxUpdateDelayMillis` | `long`: Value is 0 or greater

Returns
`LocationRequest.Builder` | This value cannot be `null`.

### setMaxUpdates

    public LocationRequest.Builder setMaxUpdates (int maxUpdates)

Sets the maximum number of location updates for this request before this request is automatically removed. Defaults to `Integer.MAX_VALUE`, which represents an unlimited number of updates.

Parameters
`maxUpdates` | `int`: Value is between 1 and Integer.MAX_VALUE inclusive

Returns
`LocationRequest.Builder` | This value cannot be `null`.

### setMinUpdateDistanceMeters

    public LocationRequest.Builder setMinUpdateDistanceMeters (float minUpdateDistanceMeters)

Sets the minimum update distance between location updates. If a potential location update is closer to the last location update than the minimum update distance, then the potential location update will not occur. Defaults to 0, which represents no minimum update distance.

Parameters
`minUpdateDistanceMeters` | `float`: Value is between 0 and Float.MAX_VALUE inclusive

Returns
`LocationRequest.Builder` | This value cannot be `null`.

### setMinUpdateIntervalMillis

    public LocationRequest.Builder setMinUpdateIntervalMillis (long minUpdateIntervalMillis)

Sets an explicit minimum update interval. If location updates are available faster than the request interval then an update will only occur if the minimum update interval has expired since the last location update. Defaults to no explicit minimum update interval set, which means some sensible default between 0 and the interval will be chosen. The exact value is not specified at the moment. If an exact known value is required, clients should set an explicit value themselves.

Note: Some allowance for jitter is already built into the minimum update interval, so you need not worry about updates blocked simply because they arrived a fraction of a second earlier than expected.

Note: When `build()` is invoked, the minimum of the interval and the minimum update interval will be used as the minimum update interval of the built request.

Parameters
`minUpdateIntervalMillis` | `long`: Value is 0 or greater

Returns
`LocationRequest.Builder` | This value cannot be `null`.

### setQuality

    public LocationRequest.Builder setQuality (int quality)

Sets the request quality. The quality is a hint to providers on how they should weigh power vs accuracy tradeoffs. High accuracy locations may cost more power to produce, and lower accuracy locations may cost less power to produce. Defaults to `LocationRequest.QUALITY_BALANCED_POWER_ACCURACY`.

Parameters
`quality` | `int`: Value is `LocationRequest.QUALITY_LOW_POWER`, `LocationRequest.QUALITY_BALANCED_POWER_ACCURACY`, or `LocationRequest.QUALITY_HIGH_ACCURACY`

Returns
`LocationRequest.Builder` | This value cannot be `null`.

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*