我正在为 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/