直接前往內容

最常造訪的網頁

最近瀏覽的網頁

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 開發人員的最新消息和實用訣竅,協助你製作最受歡迎的 Google Play 內容。

* 必填欄位

訂閱成功!

在 WeChat 上追蹤 Google Developers

你要以瀏覽這個網站嗎?

你要求以顯示這個網頁,但你為此網站指定的語言偏好設定為

是否要變更語言偏好設定並改用瀏覽網站?稍後如要變更語言偏好設定,請利用位在每個網頁最下方的語言選單來調整設定。

你的 API 層級必須達 以上才能存取這個級別

本說明文件已隱藏,因為你為該文件選取的 API 層級為 。使用左側導覽列上方的選取工具即可變更說明文件的 API 層級。

如需進一步瞭解如何為應用程式指定 API 層級的相關資訊,請參閱 Supporting Different Platform Versions (支援不同的平台版本) (英文)。

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