android - 数据类型 `Location`存储的是什么数据?

标签 android geolocation gps

我正在为 Android 制作一个 GPS 应用程序。我需要知道用户的位置。 location 存储什么样的数据:

位置 location = locationManager.getLastKnownLocation(provider);

我的意思是它存储坐标或城市名称等吗?

最佳答案

根据 Location ,它包含:

A data class representing a geographic location.

A location can consist of a latitude, longitude, timestamp, and other information such as bearing, altitude and velocity.

All locations generated by the LocationManager are guaranteed to have a valid latitude, longitude, and timestamp (both UTC time and elapsed real-time since boot), all other parameters are optional.

是的,您可以使用设备知道的页面中的方法。

参见 Geocoder关于如何查找城市的类(class)。

关于android - 数据类型 `Location`存储的是什么数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16501940/

相关文章:

Android:为什么点击 backstack 的 Intent 通知会破坏父 MainActivity?

Android - OneSignal 回调方法从未触发(notificationReceived - notificationOpened)

android - 在根项目上找不到参数[:app]的方法include()

iphone - 将 GPS 坐标发送到服务器的最佳方式?

javascript - 如何在 Javascript 中查找/创建 GPS 点的凸包

python - 如何通过 3G 连接远程更新在 Raspberry Pi 上运行的 Python 程序?

java-me - 如何在移动设备上在室内使用 GPS?

android - 在缩放加载之前,根据实际 Uri 预估 Bitmap 的大小

javascript - 将 javascript 变量存储到 HTML 文本框中

javascript - Firefox 11 和 GeoLocation 拒绝回调