Skip to content

Most visited

Recently visited

navigation
Added in API level 1

LocationProvider

public class LocationProvider
extends Object

java.lang.Object
   ↳ android.location.LocationProvider


An abstract superclass for location providers. A location provider provides periodic reports on the geographical location of the device.

Each provider has a set of criteria under which it may be used; for example, some providers require GPS hardware and visibility to a number of satellites; others require the use of the cellular radio, or access to a specific carrier's network, or to the internet. They may also have different battery consumption characteristics or monetary costs to the user. The Criteria class allows providers to be selected based on user-specified criteria.

Summary

Constants

int AVAILABLE

int OUT_OF_SERVICE

int TEMPORARILY_UNAVAILABLE

Public methods

int getAccuracy()

Returns a constant describing horizontal accuracy of this provider.

String getName()

Returns the name of this provider.

int getPowerRequirement()

Returns the power requirement for this provider.

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

From class java.lang.Object

Constants

AVAILABLE

Added in API level 1
int AVAILABLE

Constant Value: 2 (0x00000002)

OUT_OF_SERVICE

Added in API level 1
int OUT_OF_SERVICE

Constant Value: 0 (0x00000000)

TEMPORARILY_UNAVAILABLE

Added in API level 1
int TEMPORARILY_UNAVAILABLE

Constant Value: 1 (0x00000001)

Public methods

getAccuracy

Added in API level 1
int getAccuracy ()

Returns a constant describing horizontal accuracy of this provider. If the provider returns finer grain or exact location, ACCURACY_FINE is returned, otherwise if the location is only approximate then ACCURACY_COARSE is returned.

Returns
int

getName

Added in API level 1
String getName ()

Returns the name of this provider.

Returns
String

getPowerRequirement

Added in API level 1
int getPowerRequirement ()

Returns the power requirement for this provider.

Returns
int the power requirement for this provider, as one of the constants Criteria.POWER_REQUIREMENT_*.

hasMonetaryCost

Added in API level 1
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
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
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
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
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
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
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
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
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.