Added in API level 1
Deprecated in API level 31

LocationProvider


public class LocationProvider
extends Object

java.lang.Object
   ↳ android.location.LocationProvider


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) to retrieve ProviderProperties instead.

Information about the properties of a location provider.

Summary

Constants

int AVAILABLE

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

int OUT_OF_SERVICE

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

int TEMPORARILY_UNAVAILABLE

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

Public methods

int getAccuracy()

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

String getName()

Returns the name of this provider.

int getPowerRequirement()

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

boolean 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(Criteria criteria)

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

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.

boolean requiresNetwork()

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

boolean requiresSatellite()

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

boolean supportsAltitude()

Returns true if the provider is able to provide altitude information, false otherwise.

boolean supportsBearing()

Returns true if the provider is able to provide bearing information, false otherwise.

boolean supportsSpeed()

Returns true if the provider is able to provide speed information, false otherwise.

Inherited methods

Constants

AVAILABLE

Added in API level 1
Deprecated in API level 29
public static final int AVAILABLE

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

Constant Value: 2 (0x00000002)

OUT_OF_SERVICE

Added in API level 1
Deprecated in API level 29
public static final int OUT_OF_SERVICE

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

Constant Value: 0 (0x00000000)

TEMPORARILY_UNAVAILABLE

Added in API level 1
Deprecated in API level 29
public static final int TEMPORARILY_UNAVAILABLE

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

Constant Value: 1 (0x00000001)

Public methods

getAccuracy

Added in API level 1
public int getAccuracy ()

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

Returns
int

getName

Added in API level 1
public String getName ()

Returns the name of this provider.

Returns
String

getPowerRequirement

Added in API level 1
public int getPowerRequirement ()

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

Returns
int

hasMonetaryCost

Added in API level 1
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.

Returns
boolean

meetsCriteria

Added in API level 1
public boolean meetsCriteria (Criteria criteria)

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

Parameters
criteria Criteria

Returns
boolean

requiresCell

Added in API level 1
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.

Returns
boolean

requiresNetwork

Added in API level 1
public boolean requiresNetwork ()

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

Returns
boolean

requiresSatellite

Added in API level 1
public boolean requiresSatellite ()

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

Returns
boolean

supportsAltitude

Added in API level 1
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.

Returns
boolean

supportsBearing

Added in API level 1
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.

Returns
boolean

supportsSpeed

Added in API level 1
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.

Returns
boolean