Google maps Android API getting wifi location

こ雲淡風輕ζ 提交于 2019-12-04 19:55:26

Android has multiple LocationProviders, including:

  • LocationManager.GPS_PROVIDER : get position using GPS
  • LocationManager.NETWORK_PROVIDER : get position using Wifi, cell network, etc.
  • LocationManager.PASSIVE_PROVIDER: get position using data provided by already running providers. This allows several apps to share geolocation information)

You don't have to pay anything to use NETWORK_PROVIDER
Some providers might not be present on all devices, depending on phone model and android version.

Providers have different characteristics: NETWORK is fast but not always precise enough, GPS is precise but slow and battery intensive, etc. The best strategy is to request location from several providers, and cancel pending request as soon as you get a location that is good enough depending on your criteria (precision, response time, etc.)

I found this article by Reto Meier quite useful to wrap my head around geolocation on Android

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