【发布时间】:2013-02-25 00:21:01
【问题描述】:
来自 android 文档 LocationManager.getLastKnownLocation():
返回一个 Location 指示来自最后一个已知位置的数据 从给定的提供程序获得的修复。
Note that this location could be out-of-date, for example if the device was turned off and moved to another location.
提供商多久更新一次设备位置?它是如何工作的?
我问的原因是我不想使用locationListener, 我只需要在单击按钮时获取当前地理位置,仅此而已。 我可以这样做吗?
final LocationManager mlocManager = (LocationManager) getActivity()
.getSystemService(Context.LOCATION_SERVICE);
final Location currentGeoLocation = mlocManager
.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
【问题讨论】:
标签: android