来自 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);