Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Constants](https://developer.android.com/reference/android/location/Location#constants) \| [Inherited Constants](https://developer.android.com/reference/android/location/Location#inhconstants) \| [Fields](https://developer.android.com/reference/android/location/Location#lfields) \| [Ctors](https://developer.android.com/reference/android/location/Location#pubctors) \| [Methods](https://developer.android.com/reference/android/location/Location#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/location/Location#inhmethods)

# Location

*** ** * ** ***

` public class Location `   
` extends https://developer.android.com/reference/java/lang/Object ` ` implements https://developer.android.com/reference/android/os/Parcelable `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.location.Location |

<br />

*** ** * ** ***

A data class representing a geographic location. A location consists of a latitude, longitude, timestamp, accuracy, and other information such as bearing, altitude and velocity.

All locations generated through `https://developer.android.com/reference/android/location/LocationManager` are guaranteed to have a valid latitude, longitude, timestamp (both Unix epoch time and elapsed realtime since boot), and accuracy. All other parameters are optional.

Note that Android provides the ability for applications to submit "mock" or faked locations through `https://developer.android.com/reference/android/location/LocationManager`, and that these locations can then be received by applications using LocationManager to obtain location information. These locations can be identified via the `https://developer.android.com/reference/android/location/Location#isMock()` API. Applications that wish to determine if a given location represents the best estimate of the real position of the device as opposed to a fake location coming from another application or the user should use this API. Keep in mind that the user may have a good reason for mocking their location, and thus apps should generally reject mock locations only when it is essential to their use case that only real locations are accepted.

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/location/Location#FORMAT_DEGREES` Constant used to specify formatting of a latitude or longitude in the form "\[+-\]DDD.DDDDD where D indicates degrees. |
| `int` | `https://developer.android.com/reference/android/location/Location#FORMAT_MINUTES` Constant used to specify formatting of a latitude or longitude in the form "\[+-\]DDD:MM.MMMMM" where D indicates degrees and M indicates minutes of arc (1 minute = 1/60th of a degree). |
| `int` | `https://developer.android.com/reference/android/location/Location#FORMAT_SECONDS` Constant used to specify formatting of a latitude or longitude in the form "DDD:MM:SS.SSSSS" where D indicates degrees, M indicates minutes of arc, and S indicates seconds of arc (1 minute = 1/60th of a degree, 1 second = 1/3600th of a degree). |

### Inherited constants

From interface `https://developer.android.com/reference/android/os/Parcelable` `int` `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR`

Descriptor bit used with `https://developer.android.com/reference/android/os/Parcelable#describeContents()`: indicates that the Parcelable object's flattened representation includes a file descriptor.
`int` `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`

Flag for use with `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`: the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`".

| ### Fields ||
|---|---|
| ` public static final https://developer.android.com/reference/android/os/Parcelable.Creator<https://developer.android.com/reference/android/location/Location>` | `https://developer.android.com/reference/android/location/Location#CREATOR` <br /> |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/location/Location#Location(android.location.Location)(https://developer.android.com/reference/android/location/Location location) ` Constructs a new location copied from the given location. |
| ` https://developer.android.com/reference/android/location/Location#Location(java.lang.String)(https://developer.android.com/reference/java/lang/String provider) ` Constructs a new location with a named provider. |

| ### Public methods ||
|---|---|
| ` float` | ` https://developer.android.com/reference/android/location/Location#bearingTo(android.location.Location)(https://developer.android.com/reference/android/location/Location dest) ` Returns the approximate initial bearing in degrees east of true north when traveling along the shortest path between this location and the given location. |
| ` static https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/location/Location#convert(double,%20int)(double coordinate, int outputType) ` Converts a latitude/longitude coordinate to a String representation. |
| ` static double` | ` https://developer.android.com/reference/android/location/Location#convert(java.lang.String)(https://developer.android.com/reference/java/lang/String coordinate) ` Converts a String in one of the formats described by `https://developer.android.com/reference/android/location/Location#FORMAT_DEGREES`, `https://developer.android.com/reference/android/location/Location#FORMAT_MINUTES`, or `https://developer.android.com/reference/android/location/Location#FORMAT_SECONDS` into a double. |
| ` int` | ` https://developer.android.com/reference/android/location/Location#describeContents()() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
| ` static void` | ` https://developer.android.com/reference/android/location/Location#distanceBetween(double,%20double,%20double,%20double,%20float[])(double startLatitude, double startLongitude, double endLatitude, double endLongitude, float[] results) ` Computes the approximate distance in meters between two locations, and optionally the initial and final bearings of the shortest path between them. |
| ` float` | ` https://developer.android.com/reference/android/location/Location#distanceTo(android.location.Location)(https://developer.android.com/reference/android/location/Location dest) ` Returns the approximate distance in meters between this location and the given location. |
| ` void` | ` https://developer.android.com/reference/android/location/Location#dump(android.util.Printer,%20java.lang.String)(https://developer.android.com/reference/android/util/Printer pw, https://developer.android.com/reference/java/lang/String prefix) ` *This method was deprecated in API level 33. Prefer to use `https://developer.android.com/reference/android/location/Location#toString()` along with whatever custom formatting is required instead of this method. It is not this class's job to manage print representations.* |
| ` boolean` | ` https://developer.android.com/reference/android/location/Location#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) ` Location equality is provided primarily for test purposes. |
| ` float` | ` https://developer.android.com/reference/android/location/Location#getAccuracy()() ` Returns the estimated horizontal accuracy radius in meters of this location at the 68th percentile confidence level. |
| ` double` | ` https://developer.android.com/reference/android/location/Location#getAltitude()() ` The altitude of this location in meters above the WGS84 reference ellipsoid. |
| ` float` | ` https://developer.android.com/reference/android/location/Location#getBearing()() ` Returns the bearing at the time of this location in degrees. |
| ` float` | ` https://developer.android.com/reference/android/location/Location#getBearingAccuracyDegrees()() ` Returns the estimated bearing accuracy in degrees of this location at the 68th percentile confidence level. |
| ` long` | ` https://developer.android.com/reference/android/location/Location#getElapsedRealtimeAgeMillis(long)(long referenceRealtimeMs) ` A convenience method that returns the age of this location with respect to the given reference elapsed realtime. |
| ` long` | ` https://developer.android.com/reference/android/location/Location#getElapsedRealtimeAgeMillis()() ` A convenience methods that returns the age of this location in milliseconds with respect to the current elapsed realtime. |
| ` long` | ` https://developer.android.com/reference/android/location/Location#getElapsedRealtimeMillis()() ` Return the time of this fix in milliseconds of elapsed realtime since system boot. |
| ` long` | ` https://developer.android.com/reference/android/location/Location#getElapsedRealtimeNanos()() ` Return the time of this fix in nanoseconds of elapsed realtime since system boot. |
| ` double` | ` https://developer.android.com/reference/android/location/Location#getElapsedRealtimeUncertaintyNanos()() ` Get the uncertainty in nanoseconds of the precision of `https://developer.android.com/reference/android/location/Location#getElapsedRealtimeNanos()` at the 68th percentile confidence level. |
| ` https://developer.android.com/reference/android/os/Bundle` | ` https://developer.android.com/reference/android/location/Location#getExtras()() ` Returns an optional bundle of additional information associated with this location. |
| ` double` | ` https://developer.android.com/reference/android/location/Location#getLatitude()() ` Get the latitude in degrees. |
| ` double` | ` https://developer.android.com/reference/android/location/Location#getLongitude()() ` Get the longitude in degrees. |
| ` float` | ` https://developer.android.com/reference/android/location/Location#getMslAltitudeAccuracyMeters()() ` Returns the estimated Mean Sea Level altitude accuracy in meters of this location at the 68th percentile confidence level. |
| ` double` | ` https://developer.android.com/reference/android/location/Location#getMslAltitudeMeters()() ` Returns the Mean Sea Level altitude of this location in meters. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/location/Location#getProvider()() ` Returns the name of the provider associated with this location. |
| ` float` | ` https://developer.android.com/reference/android/location/Location#getSpeed()() ` Returns the speed at the time of this location in meters per second. |
| ` float` | ` https://developer.android.com/reference/android/location/Location#getSpeedAccuracyMetersPerSecond()() ` Returns the estimated speed accuracy in meters per second of this location at the 68th percentile confidence level. |
| ` long` | ` https://developer.android.com/reference/android/location/Location#getTime()() ` Returns the Unix epoch time of this location fix, in milliseconds since the start of the Unix epoch (00:00:00 January 1, 1970 UTC). |
| ` float` | ` https://developer.android.com/reference/android/location/Location#getVerticalAccuracyMeters()() ` Returns the estimated altitude accuracy in meters of this location at the 68th percentile confidence level. |
| ` boolean` | ` https://developer.android.com/reference/android/location/Location#hasAccuracy()() ` Returns true if this location has a horizontal accuracy, false otherwise. |
| ` boolean` | ` https://developer.android.com/reference/android/location/Location#hasAltitude()() ` Returns true if this location has an altitude, false otherwise. |
| ` boolean` | ` https://developer.android.com/reference/android/location/Location#hasBearing()() ` True if this location has a bearing, false otherwise. |
| ` boolean` | ` https://developer.android.com/reference/android/location/Location#hasBearingAccuracy()() ` Returns true if this location has a bearing accuracy, false otherwise. |
| ` boolean` | ` https://developer.android.com/reference/android/location/Location#hasElapsedRealtimeUncertaintyNanos()() ` True if this location has an elapsed realtime uncertainty, false otherwise. |
| ` boolean` | ` https://developer.android.com/reference/android/location/Location#hasMslAltitude()() ` Returns true if this location has a Mean Sea Level altitude, false otherwise. |
| ` boolean` | ` https://developer.android.com/reference/android/location/Location#hasMslAltitudeAccuracy()() ` Returns true if this location has a Mean Sea Level altitude accuracy, false otherwise. |
| ` boolean` | ` https://developer.android.com/reference/android/location/Location#hasSpeed()() ` True if this location has a speed, false otherwise. |
| ` boolean` | ` https://developer.android.com/reference/android/location/Location#hasSpeedAccuracy()() ` Returns true if this location has a speed accuracy, false otherwise. |
| ` boolean` | ` https://developer.android.com/reference/android/location/Location#hasVerticalAccuracy()() ` Returns true if this location has a vertical accuracy, false otherwise. |
| ` int` | ` https://developer.android.com/reference/android/location/Location#hashCode()() ` Returns a hash code value for the object. |
| ` boolean` | ` https://developer.android.com/reference/android/location/Location#isComplete()() ` Return true if this location is considered complete. |
| ` boolean` | ` https://developer.android.com/reference/android/location/Location#isFromMockProvider()() ` *This method was deprecated in API level 31. Prefer `https://developer.android.com/reference/android/location/Location#isMock()` instead.* |
| ` boolean` | ` https://developer.android.com/reference/android/location/Location#isMock()() ` Returns true if this location is marked as a mock location. |
| ` void` | ` https://developer.android.com/reference/android/location/Location#removeAccuracy()() ` Remove the horizontal accuracy from this location. |
| ` void` | ` https://developer.android.com/reference/android/location/Location#removeAltitude()() ` Removes the altitude from this location. |
| ` void` | ` https://developer.android.com/reference/android/location/Location#removeBearing()() ` Remove the bearing from this location. |
| ` void` | ` https://developer.android.com/reference/android/location/Location#removeBearingAccuracy()() ` Remove the bearing accuracy from this location. |
| ` void` | ` https://developer.android.com/reference/android/location/Location#removeElapsedRealtimeUncertaintyNanos()() ` Removes the elapsed realtime uncertainty from this location. |
| ` void` | ` https://developer.android.com/reference/android/location/Location#removeMslAltitude()() ` Removes the Mean Sea Level altitude from this location. |
| ` void` | ` https://developer.android.com/reference/android/location/Location#removeMslAltitudeAccuracy()() ` Removes the Mean Sea Level altitude accuracy from this location. |
| ` void` | ` https://developer.android.com/reference/android/location/Location#removeSpeed()() ` Remove the speed from this location. |
| ` void` | ` https://developer.android.com/reference/android/location/Location#removeSpeedAccuracy()() ` Remove the speed accuracy from this location. |
| ` void` | ` https://developer.android.com/reference/android/location/Location#removeVerticalAccuracy()() ` Remove the vertical accuracy from this location. |
| ` void` | ` https://developer.android.com/reference/android/location/Location#reset()() ` Sets the provider to null, removes all optional fields, and sets the values of all other fields to zero. |
| ` void` | ` https://developer.android.com/reference/android/location/Location#set(android.location.Location)(https://developer.android.com/reference/android/location/Location location) ` Turns this location into a copy of the given location. |
| ` void` | ` https://developer.android.com/reference/android/location/Location#setAccuracy(float)(float horizontalAccuracyMeters) ` Set the horizontal accuracy in meters of this location. |
| ` void` | ` https://developer.android.com/reference/android/location/Location#setAltitude(double)(double altitudeMeters) ` Set the altitude of this location in meters above the WGS84 reference ellipsoid. |
| ` void` | ` https://developer.android.com/reference/android/location/Location#setBearing(float)(float bearingDegrees) ` Set the bearing at the time of this location, in degrees. |
| ` void` | ` https://developer.android.com/reference/android/location/Location#setBearingAccuracyDegrees(float)(float bearingAccuracyDegrees) ` Set the bearing accuracy in degrees of this location. |
| ` void` | ` https://developer.android.com/reference/android/location/Location#setElapsedRealtimeNanos(long)(long elapsedRealtimeNs) ` Set the time of this location in nanoseconds of elapsed realtime since system boot. |
| ` void` | ` https://developer.android.com/reference/android/location/Location#setElapsedRealtimeUncertaintyNanos(double)(double elapsedRealtimeUncertaintyNs) ` Sets the uncertainty in nanoseconds of the precision of the elapsed realtime timestamp at a 68% confidence level. |
| ` void` | ` https://developer.android.com/reference/android/location/Location#setExtras(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle extras) ` Sets the extra information associated with this fix to the given Bundle. |
| ` void` | ` https://developer.android.com/reference/android/location/Location#setLatitude(double)(double latitudeDegrees) ` Set the latitude of this location. |
| ` void` | ` https://developer.android.com/reference/android/location/Location#setLongitude(double)(double longitudeDegrees) ` Set the longitude of this location. |
| ` void` | ` https://developer.android.com/reference/android/location/Location#setMock(boolean)(boolean mock) ` Sets whether this location is marked as a mock location. |
| ` void` | ` https://developer.android.com/reference/android/location/Location#setMslAltitudeAccuracyMeters(float)(float mslAltitudeAccuracyMeters) ` Sets the Mean Sea Level altitude accuracy of this location in meters. |
| ` void` | ` https://developer.android.com/reference/android/location/Location#setMslAltitudeMeters(double)(double mslAltitudeMeters) ` Sets the Mean Sea Level altitude of this location in meters. |
| ` void` | ` https://developer.android.com/reference/android/location/Location#setProvider(java.lang.String)(https://developer.android.com/reference/java/lang/String provider) ` Sets the name of the provider associated with this location |
| ` void` | ` https://developer.android.com/reference/android/location/Location#setSpeed(float)(float speedMetersPerSecond) ` Set the speed at the time of this location, in meters per second. |
| ` void` | ` https://developer.android.com/reference/android/location/Location#setSpeedAccuracyMetersPerSecond(float)(float speedAccuracyMeterPerSecond) ` Set the speed accuracy of this location in meters per second. |
| ` void` | ` https://developer.android.com/reference/android/location/Location#setTime(long)(long timeMs) ` Sets the Unix epoch time of this location fix, in milliseconds since the start of the Unix epoch (00:00:00 January 1 1970 UTC). |
| ` void` | ` https://developer.android.com/reference/android/location/Location#setVerticalAccuracyMeters(float)(float altitudeAccuracyMeters) ` Set the altitude accuracy of this location in meters. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/location/Location#toString()() ` Returns a string representation of the object. |
| ` void` | ` https://developer.android.com/reference/android/location/Location#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel parcel, int flags) ` Flatten this object in to a Parcel. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.
From interface ` https://developer.android.com/reference/android/os/Parcelable ` ` abstract int` ` https://developer.android.com/reference/android/os/Parcelable#describeContents()() `

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.
` abstract void` ` https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags) `

Flatten this object in to a Parcel.

## Constants

### FORMAT_DEGREES

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FORMAT_DEGREES
```

Constant used to specify formatting of a latitude or longitude in the form "\[+-\]DDD.DDDDD where D indicates degrees.

<br />

Constant Value: 0 (0x00000000)

### FORMAT_MINUTES

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FORMAT_MINUTES
```

Constant used to specify formatting of a latitude or longitude in the form "\[+-\]DDD:MM.MMMMM" where D indicates degrees and M indicates minutes of arc (1 minute = 1/60th of a degree).

<br />

Constant Value: 1 (0x00000001)

### FORMAT_SECONDS

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FORMAT_SECONDS
```

Constant used to specify formatting of a latitude or longitude in the form "DDD:MM:SS.SSSSS" where D indicates degrees, M indicates minutes of arc, and S indicates seconds of arc (1 minute = 1/60th of a degree, 1 second = 1/3600th of a degree).

<br />

Constant Value: 2 (0x00000002)

## Fields

### CREATOR

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final Creator<Location> CREATOR
```

<br />

<br />

## Public constructors

### Location

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Location (Location location)
```

Constructs a new location copied from the given location.

<br />

| Parameters ||
|---|---|
| `location` | `Location`: This value cannot be `null`. <br /> |

### Location

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Location (String provider)
```

Constructs a new location with a named provider. By default all values are zero, and no optional values are present.

<br />

| Parameters ||
|---|---|
| `provider` | `String`: the location provider name associated with this location. This value may be `null`. <br /> |

## Public methods

### bearingTo

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public float bearingTo (Location dest)
```

Returns the approximate initial bearing in degrees east of true north when traveling along the shortest path between this location and the given location. The shortest path is defined using the WGS84 ellipsoid. Locations that are (nearly) antipodal may produce meaningless results.

<br />

| Parameters ||
|---|---|
| `dest` | `Location`: the destination location. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `float` | the initial bearing in degrees <br /> |

### convert

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static String convert (double coordinate, 
                int outputType)
```

Converts a latitude/longitude coordinate to a String representation. The outputType must be one of `https://developer.android.com/reference/android/location/Location#FORMAT_DEGREES`, `https://developer.android.com/reference/android/location/Location#FORMAT_MINUTES`, or `https://developer.android.com/reference/android/location/Location#FORMAT_SECONDS`. The coordinate must be a number between -180.0 and 180.0, inclusive. This conversion is performed in a method that is dependent on the default locale, and so is not guaranteed to round-trip with `https://developer.android.com/reference/android/location/Location#convert(java.lang.String)`.

<br />

| Parameters ||
|---|---|
| `coordinate` | `double` <br /> |
| `outputType` | `int`: Value is one of the following: - `https://developer.android.com/reference/android/location/Location#FORMAT_DEGREES` - `https://developer.android.com/reference/android/location/Location#FORMAT_MINUTES` - `https://developer.android.com/reference/android/location/Location#FORMAT_SECONDS` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if coordinate is less than -180.0, greater than 180.0, or is not a number. |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if outputType is not a recognized value. |

### convert

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static double convert (String coordinate)
```

Converts a String in one of the formats described by `https://developer.android.com/reference/android/location/Location#FORMAT_DEGREES`, `https://developer.android.com/reference/android/location/Location#FORMAT_MINUTES`, or `https://developer.android.com/reference/android/location/Location#FORMAT_SECONDS` into a double. This conversion is performed in a locale agnostic method, and so is not guaranteed to round-trip with `https://developer.android.com/reference/android/location/Location#convert(double,%20int)`.

<br />

| Parameters ||
|---|---|
| `coordinate` | `String`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `double` | <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the coordinate is not in one of the valid formats. |
| `https://developer.android.com/reference/java/lang/NullPointerException` | if coordinate is null |

### describeContents

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int describeContents ()
```

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`, the return value of this method must include the `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` bit.

<br />

| Returns ||
|---|---|
| `int` | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either `0` or - `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` |

### distanceBetween

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static void distanceBetween (double startLatitude, 
                double startLongitude, 
                double endLatitude, 
                double endLongitude, 
                float[] results)
```

Computes the approximate distance in meters between two locations, and optionally the initial and final bearings of the shortest path between them. Distance and bearing are defined using the WGS84 ellipsoid.

The computed distance is stored in results\[0\]. If results has length 2 or greater, the initial bearing is stored in results\[1\]. If results has length 3 or greater, the final bearing is stored in results\[2\].

<br />

| Parameters ||
|---|---|
| `startLatitude` | `double`: the starting latitude. Value is between -90.0f and 90.0f inclusive <br /> |
| `startLongitude` | `double`: the starting longitude. Value is between -180.0f and 180.0f inclusive <br /> |
| `endLatitude` | `double`: the ending latitude. Value is between -90.0f and 90.0f inclusive <br /> |
| `endLongitude` | `double`: the ending longitude. Value is between -180.0f and 180.0f inclusive <br /> |
| `results` | `float`: an array of floats to hold the results <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if results is null or has length \< 1 |

### distanceTo

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public float distanceTo (Location dest)
```

Returns the approximate distance in meters between this location and the given location. Distance is defined using the WGS84 ellipsoid.

<br />

| Parameters ||
|---|---|
| `dest` | `Location`: the destination location. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `float` | the approximate distance in meters. Value is 0.0f or greater <br /> |

### dump

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void dump (Printer pw, 
                String prefix)
```

<br />

**This method was deprecated in API level 33.**   

Prefer to use `https://developer.android.com/reference/android/location/Location#toString()` along with whatever custom formatting is required instead of this method. It is not this class's job to manage print representations.

Dumps location information to the given Printer.

<br />

| Parameters ||
|---|---|
| `pw` | `Printer`: This value cannot be `null`. <br /> |
| `prefix` | `String`: This value may be `null`. <br /> |

### equals

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean equals (Object o)
```

Location equality is provided primarily for test purposes. Comparing locations for equality in production may indicate incorrect assumptions, and should be avoided whenever possible.

Indicates whether some other object is "equal to" this one.

The `equals` method implements an equivalence relation on non-null object references:

- It is *reflexive*: for any non-null reference value `x`, `x.equals(x)` should return `true`.
- It is *symmetric*: for any non-null reference values `x` and `y`, `x.equals(y)` should return `true` if and only if `y.equals(x)` returns `true`.
- It is *transitive*: for any non-null reference values `x`, `y`, and `z`, if `x.equals(y)` returns `true` and `y.equals(z)` returns `true`, then `x.equals(z)` should return `true`.
- It is *consistent*: for any non-null reference values `x` and `y`, multiple invocations of `x.equals(y)` consistently return `true` or consistently return `false`, provided no information used in `equals` comparisons on the objects is modified.
- For any non-null reference value `x`, `x.equals(null)` should return `false`.

An equivalence relation partitions the elements it operates on into *equivalence classes*; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

<br />

| Parameters ||
|---|---|
| `o` | `Object`: This value may be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if this object is the same as the obj argument; `false` otherwise. <br /> |

### getAccuracy

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public float getAccuracy ()
```

Returns the estimated horizontal accuracy radius in meters of this location at the 68th percentile confidence level. This means that there is a 68% chance that the true location of the device is within a distance of this uncertainty of the reported location. Another way of putting this is that if a circle with a radius equal to this accuracy is drawn around the reported location, there is a 68% chance that the true location falls within this circle. This accuracy value is only valid for horizontal positioning, and not vertical positioning.

This is only valid if `https://developer.android.com/reference/android/location/Location#hasAccuracy()` is true. All locations generated by the `https://developer.android.com/reference/android/location/LocationManager` include horizontal accuracy.

<br />

| Returns ||
|---|---|
| `float` | horizontal accuracy of this location. Value is 0.0f or greater <br /> |

### getAltitude

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public double getAltitude ()
```

The altitude of this location in meters above the WGS84 reference ellipsoid.

This is only valid if `https://developer.android.com/reference/android/location/Location#hasAltitude()` is true.

<br />

| Returns ||
|---|---|
| `double` | altitude of this location <br /> |

### getBearing

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public float getBearing ()
```

Returns the bearing at the time of this location in degrees. Bearing is the horizontal direction of travel of this device and is unrelated to the device orientation. The bearing is guaranteed to be in the range \[0, 360).

This is only valid if `https://developer.android.com/reference/android/location/Location#hasBearing()` is true.

<br />

| Returns ||
|---|---|
| `float` | bearing at the time of this location. Value is between 0.0f and 360.0f inclusive <br /> |

### getBearingAccuracyDegrees

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public float getBearingAccuracyDegrees ()
```

Returns the estimated bearing accuracy in degrees of this location at the 68th percentile confidence level. This means that there is 68% chance that the true bearing at the time of this location falls within `https://developer.android.com/reference/android/location/Location#getBearing()` ()} +/- this uncertainty.

This is only valid if `https://developer.android.com/reference/android/location/Location#hasBearingAccuracy()` ()} is true.

<br />

| Returns ||
|---|---|
| `float` | bearing accuracy in degrees of this location. Value is 0.0f or greater <br /> |

### getElapsedRealtimeAgeMillis

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public long getElapsedRealtimeAgeMillis (long referenceRealtimeMs)
```

A convenience method that returns the age of this location with respect to the given reference elapsed realtime.

<br />

| Parameters ||
|---|---|
| `referenceRealtimeMs` | `long`: reference realtime in milliseconds. Value is 0 or greater <br /> |

| Returns ||
|---|---|
| `long` | age of this location in milliseconds <br /> |

### getElapsedRealtimeAgeMillis

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public long getElapsedRealtimeAgeMillis ()
```

A convenience methods that returns the age of this location in milliseconds with respect to the current elapsed realtime.

<br />

| Returns ||
|---|---|
| `long` | age of this location in milliseconds. Value is 0 or greater <br /> |

### getElapsedRealtimeMillis

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public long getElapsedRealtimeMillis ()
```

Return the time of this fix in milliseconds of elapsed realtime since system boot.

<br />

| Returns ||
|---|---|
| `long` | elapsed realtime of this location in milliseconds. Value is 0 or greater <br /> |

**See also:**

- `https://developer.android.com/reference/android/location/Location#getElapsedRealtimeNanos()`

### getElapsedRealtimeNanos

Added in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public long getElapsedRealtimeNanos ()
```

Return the time of this fix in nanoseconds of elapsed realtime since system boot.

This value can be compared with `https://developer.android.com/reference/android/os/SystemClock#elapsedRealtimeNanos()` to reliably order or compare locations. This is reliable because elapsed realtime is guaranteed to be monotonic and continues to increment even when the system is in deep sleep (unlike `https://developer.android.com/reference/android/location/Location#getTime()`). However, since elapsed realtime is with reference to system boot, it does not make sense to use this value to order or compare locations across boot cycles or devices.

All locations generated by the `https://developer.android.com/reference/android/location/LocationManager` are guaranteed to have a valid elapsed realtime set.

<br />

| Returns ||
|---|---|
| `long` | elapsed realtime of this location in nanoseconds. Value is 0 or greater <br /> |

### getElapsedRealtimeUncertaintyNanos

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public double getElapsedRealtimeUncertaintyNanos ()
```

Get the uncertainty in nanoseconds of the precision of `https://developer.android.com/reference/android/location/Location#getElapsedRealtimeNanos()` at the 68th percentile confidence level. This means that there is 68% chance that the true elapsed realtime of this location is within `https://developer.android.com/reference/android/location/Location#getElapsedRealtimeNanos()` +/- this uncertainty.

This is only valid if `https://developer.android.com/reference/android/location/Location#hasElapsedRealtimeUncertaintyNanos()` is true.

<br />

| Returns ||
|---|---|
| `double` | uncertainty in nanoseconds of the elapsed realtime of this location. Value is 0.0f or greater <br /> |

### getExtras

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Bundle getExtras ()
```

Returns an optional bundle of additional information associated with this location. The keys and values within the bundle are determined by the location provider.

Common key/value pairs are listed below. There is no guarantee that these key/value pairs will be present for any location.

- satellites - the number of satellites used to derive a GNSS fix. This key was deprecated in API 34 because the information can be obtained through more accurate means, such as by referencing `https://developer.android.com/reference/android/location/GnssStatus#usedInFix(int)`.

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/os/Bundle` | This value may be `null`. <br /> |

### getLatitude

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public double getLatitude ()
```

Get the latitude in degrees. All locations generated by the `https://developer.android.com/reference/android/location/LocationManager` will have a valid latitude.

<br />

| Returns ||
|---|---|
| `double` | latitude of this location. Value is between -90.0f and 90.0f inclusive <br /> |

### getLongitude

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public double getLongitude ()
```

Get the longitude in degrees. All locations generated by the `https://developer.android.com/reference/android/location/LocationManager` will have a valid longitude.

<br />

| Returns ||
|---|---|
| `double` | longitude of this location. Value is between -180.0f and 180.0f inclusive <br /> |

### getMslAltitudeAccuracyMeters

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public float getMslAltitudeAccuracyMeters ()
```

Returns the estimated Mean Sea Level altitude accuracy in meters of this location at the 68th percentile confidence level. This means that there is 68% chance that the true Mean Sea Level altitude of this location falls within `https://developer.android.com/reference/android/location/Location#getMslAltitudeMeters()` +/- this uncertainty.

This is only valid if `https://developer.android.com/reference/android/location/Location#hasMslAltitudeAccuracy()` is true.

<br />

| Returns ||
|---|---|
| `float` | Value is 0.0f or greater <br /> |

### getMslAltitudeMeters

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public double getMslAltitudeMeters ()
```

Returns the Mean Sea Level altitude of this location in meters.

This is only valid if `https://developer.android.com/reference/android/location/Location#hasMslAltitude()` is true.

<br />

| Returns ||
|---|---|
| `double` | <br /> |

### getProvider

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getProvider ()
```

Returns the name of the provider associated with this location.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the name of the provider. This value may be `null`. <br /> |

### getSpeed

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public float getSpeed ()
```

Returns the speed at the time of this location in meters per second. Note that the speed returned here may be more accurate than would be obtained simply by calculating `distance / time` for sequential positions, such as if the Doppler measurements from GNSS satellites are taken into account.

This is only valid if `https://developer.android.com/reference/android/location/Location#hasSpeed()` is true.

<br />

| Returns ||
|---|---|
| `float` | speed at the time of this location. Value is 0.0f or greater <br /> |

### getSpeedAccuracyMetersPerSecond

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public float getSpeedAccuracyMetersPerSecond ()
```

Returns the estimated speed accuracy in meters per second of this location at the 68th percentile confidence level. This means that there is 68% chance that the true speed at the time of this location falls within `https://developer.android.com/reference/android/location/Location#getSpeed()` ()} +/- this uncertainty.

This is only valid if `https://developer.android.com/reference/android/location/Location#hasSpeedAccuracy()` is true.

<br />

| Returns ||
|---|---|
| `float` | vertical accuracy of this location. Value is 0.0f or greater <br /> |

### getTime

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public long getTime ()
```

Returns the Unix epoch time of this location fix, in milliseconds since the start of the Unix epoch (00:00:00 January 1, 1970 UTC).

There is no guarantee that different locations have times set from the same clock. Locations derived from the `https://developer.android.com/reference/android/location/LocationManager#GPS_PROVIDER` are guaranteed to have their time originate from the clock in use by the satellite constellation that provided the fix. Locations derived from other providers may use any clock to set their time, though it is most common to use the device's Unix epoch time system clock (which may be incorrect).

Note that the device's Unix epoch time system clock is not monotonic; it can jump forwards or backwards unpredictably and may be changed at any time by the user, so this time should not be used to order or compare locations. Prefer `https://developer.android.com/reference/android/location/Location#getElapsedRealtimeNanos()` for that purpose, as the elapsed realtime clock is guaranteed to be monotonic.

On the other hand, this method may be useful for presenting a human-readable time to the user, or as a heuristic for comparing location fixes across reboot or across devices.

All locations generated by the `https://developer.android.com/reference/android/location/LocationManager` are guaranteed to have this time set, however remember that the device's system clock may have changed since the location was generated.

<br />

| Returns ||
|---|---|
| `long` | the Unix epoch time of this location. Value is 0 or greater <br /> |

### getVerticalAccuracyMeters

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public float getVerticalAccuracyMeters ()
```

Returns the estimated altitude accuracy in meters of this location at the 68th percentile confidence level. This means that there is 68% chance that the true altitude of this location falls within `https://developer.android.com/reference/android/location/Location#getAltitude()` ()} +/- this uncertainty.

This is only valid if `https://developer.android.com/reference/android/location/Location#hasVerticalAccuracy()` is true.

<br />

| Returns ||
|---|---|
| `float` | vertical accuracy of this location. Value is 0.0f or greater <br /> |

### hasAccuracy

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean hasAccuracy ()
```

Returns true if this location has a horizontal accuracy, false otherwise.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### hasAltitude

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean hasAltitude ()
```

Returns true if this location has an altitude, false otherwise.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### hasBearing

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean hasBearing ()
```

True if this location has a bearing, false otherwise.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### hasBearingAccuracy

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean hasBearingAccuracy ()
```

Returns true if this location has a bearing accuracy, false otherwise.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### hasElapsedRealtimeUncertaintyNanos

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean hasElapsedRealtimeUncertaintyNanos ()
```

True if this location has an elapsed realtime uncertainty, false otherwise.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### hasMslAltitude

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean hasMslAltitude ()
```

Returns true if this location has a Mean Sea Level altitude, false otherwise.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### hasMslAltitudeAccuracy

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean hasMslAltitudeAccuracy ()
```

Returns true if this location has a Mean Sea Level altitude accuracy, false otherwise.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### hasSpeed

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean hasSpeed ()
```

True if this location has a speed, false otherwise.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### hasSpeedAccuracy

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean hasSpeedAccuracy ()
```

Returns true if this location has a speed accuracy, false otherwise.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### hasVerticalAccuracy

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean hasVerticalAccuracy ()
```

Returns true if this location has a vertical accuracy, false otherwise.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### hashCode

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int hashCode ()
```

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by `https://developer.android.com/reference/java/util/HashMap`.

The general contract of `hashCode` is:

- Whenever it is invoked on the same object more than once during an execution of a Java application, the `hashCode` method must consistently return the same integer, provided no information used in `equals` comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
- If two objects are equal according to the `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)` method, then calling the `hashCode` method on each of the two objects must produce the same integer result.
- It is *not* required that if two objects are unequal according to the `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)` method, then calling the `hashCode` method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

<br />

<br />

| Returns ||
|---|---|
| `int` | a hash code value for this object. <br /> |

### isComplete

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isComplete ()
```

Return true if this location is considered complete. A location is considered complete if it has a non-null provider, accuracy, and non-zero time and elapsed realtime. The exact definition of completeness may change over time.

All locations supplied by the `https://developer.android.com/reference/android/location/LocationManager` are guaranteed to be complete.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### isFromMockProvider

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isFromMockProvider ()
```

<br />

**This method was deprecated in API level 31.**   

Prefer `https://developer.android.com/reference/android/location/Location#isMock()` instead.

Returns true if this is a mock location. If this location comes from the Android framework, this indicates that the location was provided by a test location provider, and thus may not be related to the actual location of the device.

<br />

| Returns ||
|---|---|
| `boolean` | true if this location came from a mock provider, false otherwise <br /> |

### isMock

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isMock ()
```

Returns true if this location is marked as a mock location. If this location comes from the Android framework, this indicates that the location was provided by a test location provider, and thus may not be related to the actual location of the device.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

**See also:**

- `https://developer.android.com/reference/android/location/LocationManager#addTestProvider(java.lang.String,%20android.location.provider.ProviderProperties)`

### removeAccuracy

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeAccuracy ()
```

Remove the horizontal accuracy from this location.

<br />

### removeAltitude

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeAltitude ()
```

Removes the altitude from this location.

<br />

### removeBearing

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeBearing ()
```

Remove the bearing from this location.

<br />

### removeBearingAccuracy

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeBearingAccuracy ()
```

Remove the bearing accuracy from this location.

<br />

### removeElapsedRealtimeUncertaintyNanos

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeElapsedRealtimeUncertaintyNanos ()
```

Removes the elapsed realtime uncertainty from this location.

<br />

### removeMslAltitude

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeMslAltitude ()
```

Removes the Mean Sea Level altitude from this location.

<br />

### removeMslAltitudeAccuracy

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeMslAltitudeAccuracy ()
```

Removes the Mean Sea Level altitude accuracy from this location.

<br />

### removeSpeed

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeSpeed ()
```

Remove the speed from this location.

<br />

### removeSpeedAccuracy

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeSpeedAccuracy ()
```

Remove the speed accuracy from this location.

<br />

### removeVerticalAccuracy

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeVerticalAccuracy ()
```

Remove the vertical accuracy from this location.

<br />

### reset

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void reset ()
```

Sets the provider to null, removes all optional fields, and sets the values of all other fields to zero.

<br />

### set

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void set (Location location)
```

Turns this location into a copy of the given location.

<br />

| Parameters ||
|---|---|
| `location` | `Location`: This value cannot be `null`. <br /> |

### setAccuracy

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setAccuracy (float horizontalAccuracyMeters)
```

Set the horizontal accuracy in meters of this location.

<br />

| Parameters ||
|---|---|
| `horizontalAccuracyMeters` | `float`: horizontal altitude in meters. Value is 0.0f or greater <br /> |

### setAltitude

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setAltitude (double altitudeMeters)
```

Set the altitude of this location in meters above the WGS84 reference ellipsoid.

<br />

| Parameters ||
|---|---|
| `altitudeMeters` | `double`: altitude in meters <br /> |

### setBearing

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setBearing (float bearingDegrees)
```

Set the bearing at the time of this location, in degrees. The given bearing will be converted into the range \[0, 360).

Note: passing in extremely high or low floating point values to this function may produce strange results due to the intricacies of floating point math.

<br />

| Parameters ||
|---|---|
| `bearingDegrees` | `float`: bearing in degrees <br /> |

### setBearingAccuracyDegrees

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setBearingAccuracyDegrees (float bearingAccuracyDegrees)
```

Set the bearing accuracy in degrees of this location.

<br />

| Parameters ||
|---|---|
| `bearingAccuracyDegrees` | `float`: bearing accuracy in degrees. Value is 0.0f or greater <br /> |

### setElapsedRealtimeNanos

Added in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setElapsedRealtimeNanos (long elapsedRealtimeNs)
```

Set the time of this location in nanoseconds of elapsed realtime since system boot.

<br />

| Parameters ||
|---|---|
| `elapsedRealtimeNs` | `long`: elapsed realtime in nanoseconds. Value is 0 or greater <br /> |

### setElapsedRealtimeUncertaintyNanos

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setElapsedRealtimeUncertaintyNanos (double elapsedRealtimeUncertaintyNs)
```

Sets the uncertainty in nanoseconds of the precision of the elapsed realtime timestamp at a 68% confidence level.

<br />

| Parameters ||
|---|---|
| `elapsedRealtimeUncertaintyNs` | `double`: uncertainty in nanoseconds of the elapsed realtime of this location. Value is 0.0f or greater <br /> |

### setExtras

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setExtras (Bundle extras)
```

Sets the extra information associated with this fix to the given Bundle.

Note this stores a copy of the given extras, so any changes to extras after calling this method won't be reflected in the location bundle.

<br />

| Parameters ||
|---|---|
| `extras` | `Bundle`: This value may be `null`. <br /> |

### setLatitude

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setLatitude (double latitudeDegrees)
```

Set the latitude of this location.

<br />

| Parameters ||
|---|---|
| `latitudeDegrees` | `double`: latitude in degrees. Value is between -90.0f and 90.0f inclusive <br /> |

### setLongitude

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setLongitude (double longitudeDegrees)
```

Set the longitude of this location.

<br />

| Parameters ||
|---|---|
| `longitudeDegrees` | `double`: longitude in degrees. Value is between -180.0f and 180.0f inclusive <br /> |

### setMock

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setMock (boolean mock)
```

Sets whether this location is marked as a mock location.

<br />

| Parameters ||
|---|---|
| `mock` | `boolean` <br /> |

### setMslAltitudeAccuracyMeters

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setMslAltitudeAccuracyMeters (float mslAltitudeAccuracyMeters)
```

Sets the Mean Sea Level altitude accuracy of this location in meters.

<br />

| Parameters ||
|---|---|
| `mslAltitudeAccuracyMeters` | `float`: Value is 0.0f or greater <br /> |

### setMslAltitudeMeters

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setMslAltitudeMeters (double mslAltitudeMeters)
```

Sets the Mean Sea Level altitude of this location in meters.

<br />

| Parameters ||
|---|---|
| `mslAltitudeMeters` | `double` <br /> |

### setProvider

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setProvider (String provider)
```

Sets the name of the provider associated with this location

<br />

| Parameters ||
|---|---|
| `provider` | `String`: the name of the provider. This value may be `null`. <br /> |

### setSpeed

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setSpeed (float speedMetersPerSecond)
```

Set the speed at the time of this location, in meters per second.

<br />

| Parameters ||
|---|---|
| `speedMetersPerSecond` | `float`: speed in meters per second. Value is 0.0f or greater <br /> |

### setSpeedAccuracyMetersPerSecond

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setSpeedAccuracyMetersPerSecond (float speedAccuracyMeterPerSecond)
```

Set the speed accuracy of this location in meters per second.

<br />

| Parameters ||
|---|---|
| `speedAccuracyMeterPerSecond` | `float`: speed accuracy in meters per second. Value is 0.0f or greater <br /> |

### setTime

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setTime (long timeMs)
```

Sets the Unix epoch time of this location fix, in milliseconds since the start of the Unix epoch (00:00:00 January 1 1970 UTC).

<br />

| Parameters ||
|---|---|
| `timeMs` | `long`: the Unix epoch time of this location. Value is 0 or greater <br /> |

### setVerticalAccuracyMeters

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setVerticalAccuracyMeters (float altitudeAccuracyMeters)
```

Set the altitude accuracy of this location in meters.

<br />

| Parameters ||
|---|---|
| `altitudeAccuracyMeters` | `float`: altitude accuracy in meters. Value is 0.0f or greater <br /> |

### toString

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String toString ()
```

Returns a string representation of the object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | This value cannot be `null`. <br /> |

### writeToParcel

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void writeToParcel (Parcel parcel, 
                int flags)
```

Flatten this object in to a Parcel.

<br />

| Parameters ||
|---|---|
| `parcel` | `Parcel`: This value cannot be `null`. <br /> |
| `flags` | `int`: Additional flags about how the object should be written. May be 0 or `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE` |