# LocationProvider

Added in[API level 1](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)  
Summary:[Constants](https://developer.android.com/reference/android/location/LocationProvider#constants)\|[Methods](https://developer.android.com/reference/android/location/LocationProvider#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/location/LocationProvider#inhmethods)  

# LocationProvider

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/location/LocationProvider "View this page in Kotlin")\|Java

`
public


class
LocationProvider
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

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

<br />

*** ** * ** ***

<br />

**This class was deprecated in API level 31.**   
This class is incapable of representing unknown provider properties and may return incorrect results on the rare occasion when a provider's properties are unknown. Prefer using[LocationManager.getProviderProperties(String)](https://developer.android.com/reference/android/location/LocationManager#getProviderProperties(java.lang.String))to retrieve[ProviderProperties](https://developer.android.com/reference/android/location/provider/ProviderProperties)instead.

Information about the properties of a location provider.

## Summary

|                                                                                                              ### Constants                                                                                                              ||
|-------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | [AVAILABLE](https://developer.android.com/reference/android/location/LocationProvider#AVAILABLE) *This constant was deprecated in API level 29. Location provider statuses are no longer supported.*                             |
| `int` | [OUT_OF_SERVICE](https://developer.android.com/reference/android/location/LocationProvider#OUT_OF_SERVICE) *This constant was deprecated in API level 29. Location provider statuses are no longer supported.*                   |
| `int` | [TEMPORARILY_UNAVAILABLE](https://developer.android.com/reference/android/location/LocationProvider#TEMPORARILY_UNAVAILABLE) *This constant was deprecated in API level 29. Location provider statuses are no longer supported.* |

|                                                                                                                                                                                 ### Public methods                                                                                                                                                                                  ||
|-----------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` int`                                                                | ` `[getAccuracy](https://developer.android.com/reference/android/location/LocationProvider#getAccuracy())`() ` Returns the rough accuracy of this provider, one of the ProviderProperties.ACCURACY_\* constants.                                                                                             |
| ` `[String](https://developer.android.com/reference/java/lang/String) | ` `[getName](https://developer.android.com/reference/android/location/LocationProvider#getName())`() ` Returns the name of this provider.                                                                                                                                                                    |
| ` int`                                                                | ` `[getPowerRequirement](https://developer.android.com/reference/android/location/LocationProvider#getPowerRequirement())`() ` Returns the power requirement for this provider, one of the ProviderProperties.POWER_USAGE_\* constants.                                                                      |
| ` boolean`                                                            | ` `[hasMonetaryCost](https://developer.android.com/reference/android/location/LocationProvider#hasMonetaryCost())`() ` Returns true if the use of this provider may result in a monetary charge to the user, false if use is free.                                                                           |
| ` boolean`                                                            | ` `[meetsCriteria](https://developer.android.com/reference/android/location/LocationProvider#meetsCriteria(android.location.Criteria))`(`[Criteria](https://developer.android.com/reference/android/location/Criteria)` criteria) ` Returns true if this provider meets the given criteria, false otherwise. |
| ` boolean`                                                            | ` `[requiresCell](https://developer.android.com/reference/android/location/LocationProvider#requiresCell())`() ` Returns true if the provider requires access to an appropriate cellular network (e.g., to make use of cell tower IDs), false otherwise.                                                     |
| ` boolean`                                                            | ` `[requiresNetwork](https://developer.android.com/reference/android/location/LocationProvider#requiresNetwork())`() ` Returns true if the provider requires access to a data network (e.g., the Internet), false otherwise.                                                                                 |
| ` boolean`                                                            | ` `[requiresSatellite](https://developer.android.com/reference/android/location/LocationProvider#requiresSatellite())`() ` Returns true if the provider requires access to a satellite-based positioning system (e.g., GPS), false otherwise.                                                                |
| ` boolean`                                                            | ` `[supportsAltitude](https://developer.android.com/reference/android/location/LocationProvider#supportsAltitude())`() ` Returns true if the provider is able to provide altitude information, false otherwise.                                                                                              |
| ` boolean`                                                            | ` `[supportsBearing](https://developer.android.com/reference/android/location/LocationProvider#supportsBearing())`() ` Returns true if the provider is able to provide bearing information, false otherwise.                                                                                                 |
| ` boolean`                                                            | ` `[supportsSpeed](https://developer.android.com/reference/android/location/LocationProvider#supportsSpeed())`() ` Returns true if the provider is able to provide speed information, false otherwise.                                                                                                       |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](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 `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](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`                                                                  | ` `[wait](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`                                                                  | ` `[wait](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*.                                                                                             | ||

## Constants

### AVAILABLE

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

```
public static final int AVAILABLE
```

<br />

**This constant was deprecated in API level 29.**   
Location provider statuses are no longer supported.

<br />

<br />

Constant Value: 2 (0x00000002)  

### OUT_OF_SERVICE

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

```
public static final int OUT_OF_SERVICE
```

<br />

**This constant was deprecated in API level 29.**   
Location provider statuses are no longer supported.

<br />

<br />

Constant Value: 0 (0x00000000)  

### TEMPORARILY_UNAVAILABLE

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

```
public static final int TEMPORARILY_UNAVAILABLE
```

<br />

**This constant was deprecated in API level 29.**   
Location provider statuses are no longer supported.

<br />

<br />

Constant Value: 1 (0x00000001)

## Public methods

### getAccuracy

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

```
public int getAccuracy ()
```

Returns the rough accuracy of this provider, one of the ProviderProperties.ACCURACY_\* constants.

<br />

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

### getName

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

```
public String getName ()
```

Returns the name of this provider.

<br />

|                                  Returns                                   ||
|--------------------------------------------------------------------|--------|
| [String](https://developer.android.com/reference/java/lang/String) | <br /> |

### getPowerRequirement

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

```
public int getPowerRequirement ()
```

Returns the power requirement for this provider, one of the ProviderProperties.POWER_USAGE_\* constants.

<br />

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

### hasMonetaryCost

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

```
public boolean hasMonetaryCost ()
```

Returns true if the use of this provider may result in a monetary charge to the user, false if use is free. It is up to each provider to give accurate information.

<br />

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

### meetsCriteria

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

```
public boolean meetsCriteria (Criteria criteria)
```

Returns true if this provider meets the given criteria, false otherwise.

<br />

|          Parameters           ||
|------------|-------------------|
| `criteria` | `Criteria` <br /> |

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

### requiresCell

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

```
public boolean requiresCell ()
```

Returns true if the provider requires access to an appropriate cellular network (e.g., to make use of cell tower IDs), false otherwise.

<br />

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

### requiresNetwork

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

```
public boolean requiresNetwork ()
```

Returns true if the provider requires access to a data network (e.g., the Internet), false otherwise.

<br />

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

### requiresSatellite

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

```
public boolean requiresSatellite ()
```

Returns true if the provider requires access to a satellite-based positioning system (e.g., GPS), false otherwise.

<br />

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

### supportsAltitude

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

```
public boolean supportsAltitude ()
```

Returns true if the provider is able to provide altitude information, false otherwise. A provider that reports altitude under most circumstances but may occassionally not report it should return true.

<br />

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

### supportsBearing

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

```
public boolean supportsBearing ()
```

Returns true if the provider is able to provide bearing information, false otherwise. A provider that reports bearing under most circumstances but may occassionally not report it should return true.

<br />

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

### supportsSpeed

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

```
public boolean supportsSpeed ()
```

Returns true if the provider is able to provide speed information, false otherwise. A provider that reports speed under most circumstances but may occassionally not report it should return true.

<br />

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