AI-generated Key Takeaways
-
LastLocationRequest.Builder
helps constructLastLocationRequest
objects for retrieving the last known location of the device. -
It offers methods to customize the request, including setting the location granularity and maximum acceptable age of the location data.
-
Developers can create a builder with default values or initialize it with an existing
LastLocationRequest
object. -
The
build()
method generates the finalLastLocationRequest
instance based on the builder's configuration.
A builder for LastLocationRequest
.
Public Constructor Summary
Builder()
Constructs a new builder with default values.
|
|
Builder(LastLocationRequest
request)
Constructs a new builder with values copied from the given
LastLocationRequest .
|
Public Method Summary
LastLocationRequest |
build()
Builds a new
LastLocationRequest .
|
LastLocationRequest.Builder |
setGranularity(int granularity)
Sets the
Granularity
of locations returned for this request.
|
LastLocationRequest.Builder |
setMaxUpdateAgeMillis(long maxUpdateAgeMillis)
Sets the maximum age of any location returned for this request.
|
Inherited Method Summary
Public Constructors
public Builder ()
Constructs a new builder with default values.
public Builder (LastLocationRequest request)
Constructs a new builder with values copied from the given LastLocationRequest
.
Public Methods
public LastLocationRequest build ()
Builds a new LastLocationRequest
.
public LastLocationRequest.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 LastLocationRequest.Builder setMaxUpdateAgeMillis (long maxUpdateAgeMillis)
Sets the maximum age of any location returned for this request. A value of
Long.MAX_VALUE
represents an effectively unbounded maximum age.
The default value is Long.MAX_VALUE
.