LastLocationRequest.Builder
Stay organized with collections
Save and categorize content based on your preferences.
Public Constructor Summary
|
Builder()
Constructs a new builder with default values.
|
|
|
Inherited Method Summary
From class java.lang.Object
Object
|
clone()
|
boolean |
|
void |
finalize()
|
final Class<?>
|
getClass()
|
int |
hashCode()
|
final void |
notify()
|
final void |
notifyAll()
|
String
|
toString()
|
final void |
wait(long arg0, int arg1)
|
final void |
wait(long arg0)
|
final void |
wait()
|
Public Constructors
public Builder ()
Constructs a new builder with default values.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eLastLocationRequest.Builder\u003c/code\u003e helps construct \u003ccode\u003eLastLocationRequest\u003c/code\u003e objects for retrieving the last known location of the device.\u003c/p\u003e\n"],["\u003cp\u003eIt offers methods to customize the request, including setting the location granularity and maximum acceptable age of the location data.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can create a builder with default values or initialize it with an existing \u003ccode\u003eLastLocationRequest\u003c/code\u003e object.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ebuild()\u003c/code\u003e method generates the final \u003ccode\u003eLastLocationRequest\u003c/code\u003e instance based on the builder's configuration.\u003c/p\u003e\n"]]],[],null,["# LastLocationRequest.Builder\n\npublic static final class **LastLocationRequest.Builder** extends [Object](//developer.android.com/reference/java/lang/Object.html) \nA builder for [LastLocationRequest](/android/reference/com/google/android/gms/location/LastLocationRequest). \n\n### Public Constructor Summary\n\n|---|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | [Builder](/android/reference/com/google/android/gms/location/LastLocationRequest.Builder#Builder())() Constructs a new builder with default values. |\n| | [Builder](/android/reference/com/google/android/gms/location/LastLocationRequest.Builder#Builder(com.google.android.gms.location.LastLocationRequest))([LastLocationRequest](/android/reference/com/google/android/gms/location/LastLocationRequest) request) Constructs a new builder with values copied from the given [LastLocationRequest](/android/reference/com/google/android/gms/location/LastLocationRequest). |\n\n### Public Method Summary\n\n|---------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [LastLocationRequest](/android/reference/com/google/android/gms/location/LastLocationRequest) | [build](/android/reference/com/google/android/gms/location/LastLocationRequest.Builder#build())() Builds a new [LastLocationRequest](/android/reference/com/google/android/gms/location/LastLocationRequest). |\n| [LastLocationRequest.Builder](/android/reference/com/google/android/gms/location/LastLocationRequest.Builder) | [setGranularity](/android/reference/com/google/android/gms/location/LastLocationRequest.Builder#setGranularity(int))(int granularity) Sets the [Granularity](/android/reference/com/google/android/gms/location/Granularity) of locations returned for this request. |\n| [LastLocationRequest.Builder](/android/reference/com/google/android/gms/location/LastLocationRequest.Builder) | [setMaxUpdateAgeMillis](/android/reference/com/google/android/gms/location/LastLocationRequest.Builder#setMaxUpdateAgeMillis(long))(long maxUpdateAgeMillis) Sets the maximum age of any location returned for this request. |\n\n### Inherited Method Summary\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| [Object](//developer.android.com/reference/java/lang/Object.html) | clone() |\n| boolean | equals([Object](//developer.android.com/reference/java/lang/Object.html) arg0) |\n| void | finalize() |\n| final [Class](//developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](//developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Constructors\n-------------------\n\n#### public **Builder** ()\n\nConstructs a new builder with default values. \n\n#### public **Builder** ([LastLocationRequest](/android/reference/com/google/android/gms/location/LastLocationRequest) request)\n\nConstructs a new builder with values copied from the given [LastLocationRequest](/android/reference/com/google/android/gms/location/LastLocationRequest).\n\nPublic Methods\n--------------\n\n#### public [LastLocationRequest](/android/reference/com/google/android/gms/location/LastLocationRequest)\n**build** ()\n\nBuilds a new [LastLocationRequest](/android/reference/com/google/android/gms/location/LastLocationRequest). \n\n#### public [LastLocationRequest.Builder](/android/reference/com/google/android/gms/location/LastLocationRequest.Builder)\n**setGranularity** (int granularity)\n\nSets the [Granularity](/android/reference/com/google/android/gms/location/Granularity)\nof locations returned for this request. This controls whether fine or coarse locations\nmay be returned.\n\nThe default value is [Granularity.GRANULARITY_PERMISSION_LEVEL](/android/reference/com/google/android/gms/location/Granularity#GRANULARITY_PERMISSION_LEVEL). \n\n#### public [LastLocationRequest.Builder](/android/reference/com/google/android/gms/location/LastLocationRequest.Builder)\n**setMaxUpdateAgeMillis** (long maxUpdateAgeMillis)\n\nSets the maximum age of any location returned for this request. A value of\n[Long.MAX_VALUE](//developer.android.com/reference/java/lang/Long.html#MAX_VALUE)\nrepresents an effectively unbounded maximum age.\n\nThe default value is [Long.MAX_VALUE](//developer.android.com/reference/java/lang/Long.html#MAX_VALUE)."]]