跳转到相应内容

最常访问

最近访问

navigation
added in API level 1

android.location

Contains the framework API classes that define Android location-based and related services.

This API is not the recommended method for accessing Android location.
The Google Location Services API, part of Google Play services, is the preferred way to add location-awareness to your app. It offers a simpler API, higher accuracy, low-power geofencing, and more. If you are currently using the android.location API, you are strongly encouraged to switch to the Google Location Services API as soon as possible.

To learn more about the Google Location Services API, see the Location API overview.

Interfaces

GpsStatus.Listener This interface was deprecated in API level 24. use GnssStatus.Callback instead.  
GpsStatus.NmeaListener This interface was deprecated in API level 24. use OnNmeaMessageListener instead.  
LocationListener Used for receiving notifications from the LocationManager when the location has changed. 
OnNmeaMessageListener Used for receiving NMEA sentences from the GNSS. 

Classes

Address A class representing an Address, i.e, a set of Strings describing a location. 
Criteria A class indicating the application criteria for selecting a location provider. 
Geocoder A class for handling geocoding and reverse geocoding. 
GnssClock A class containing a GPS clock timestamp. 
GnssMeasurement A class representing a GNSS satellite measurement, containing raw and computed information. 
GnssMeasurementsEvent A class implementing a container for data associated with a measurement event. 
GnssMeasurementsEvent.Callback Used for receiving GNSS satellite measurements from the GNSS engine. 
GnssNavigationMessage A class containing a GNSS satellite Navigation Message. 
GnssNavigationMessage.Callback Used for receiving GNSS satellite Navigation Messages from the GNSS engine. 
GnssStatus This class represents the current state of the GNSS engine. 
GnssStatus.Callback Used for receiving notifications when GNSS events happen. 
GpsSatellite This class was deprecated in API level 24. use GnssStatus and GnssStatus.Callback.  
GpsStatus This class was deprecated in API level 24. use GnssStatus and GnssStatus.Callback.  
Location A data class representing a geographic location. 
LocationManager This class provides access to the system location services. 
LocationProvider An abstract superclass for location providers. 
SettingInjectorService Dynamically specifies the enabled status of a preference injected into the list of app settings displayed by the system settings app

For use only by apps that are included in the system image, for preferences that affect multiple apps. 

此网站会使用 Cookie 来存储您在此网站上指定的语言和显示选项偏好设置。

获取最新的 Android Developers 资讯和提示,助您在 Google Play 上取得成功。

* 必填字段

成功!

在微信上关注 Google Developers

要以浏览此网站吗?

您请求访问的是网页,但是您为此网站设置的语言偏好为

要更改您的语言偏好设置并以浏览此网站吗?如果以后您想要更改语言偏好设置,请使用每个页面底部的语言菜单。

该类需要 或更高的 API 级别

此文档已被隐藏,因为您为该文档选择的 API 级别是 。您可以使用左侧导航栏上方的选择器来更改文档的 API 级别。

要详细了解如何根据您的应用需求指定 API 级别,请参阅支持不同平台版本

Take a short survey?
Help us improve the Android developer experience. (April 2018 — Developer Survey)