Get the last known location on Android synchronously

邮差的信 提交于 2019-12-06 00:55:21

A legitimate way of doing this is to use LocationClient's

getLastLocation()

If you want to do it in a synchronous manner, you should keep in mind that it will not be a precise location, and in rare cases it may even be unavailable. Check the documentation below:

public Location getLastLocation ()

Returns the best most recent location currently available.

If a location is not available, which should happen very rarely, null will be returned. The best accuracy available while respecting the location permissions will be returned.

This method provides a simplified way to get location. It is particularly well suited for applications that do not require an accurate location and that do not want to maintain extra logic for location updates.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!