谷歌地图Android API获取WiFi位置 [英] Google maps Android API getting wifi location

查看:214
本文介绍了谷歌地图Android API获取WiFi位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我正在研究这款应用程序,通过使用手机的传感器wifi(手机实际上并未连接到热点无线网络,它只是检测到)来检测它是否会获得WiFi热点的位置。
在开始开发应用程序之前,我正在做一些初步研究,似乎Google Geolocation API将为我完成这项工作。但是,它不是免费的(至少我通过API阅读后了解了什么)。我检查了其他检测wifi热点的应用程序,我只是想知道这些应用程序是否拥有自己的数据库,包含所有的WiFi热点信息(SSID,位置坐标等),所以当wifi传感器检测到WiFi热点时,它会查找数据库并获取位置等信息。
另外,一位同事提到Google地图也存储了wifi信息。是真的吗?因为我找不到任何有关此信息。



  • LocationManager.GPS_PROVIDER :使用GPS获取位置
  • LocationManager.NETWORK_PROVIDER :使用Wifi,手机网络等获取位置。
  • LocationManager.PASSIVE_PROVIDER :使用已运行的提供商提供的数据获取头寸。这允许多个应用程序共享地理位置信息)



您不必支付任何费用即可使用 NETWORK_PROVIDER


有些提供商可能不会出现在所有设备上,具体取决于手机型号和Android版本。



供应商具有不同的特性:网络速度快但并不总是足够精确,GPS精确但速度慢且电池密集等。最佳策略是向多个供应商请求位置,并取消未决请求只要您获得的位置足够好,具体取决于您的标准(精确度,响应时间等)。

我发现这篇文章由Reto Meier在我的地理位置Android


So I am working on this app that will get the location of a wifi hotspot by just detecting it using the sensor wifi of the phone (The phone is not actually connecting to the hotspot wifi, it just detect). I was doing some preliminary research before start developing the app, and it seems that the Google Geolocation API will do the work for me. However, it is not free (at least what I understood after reading through the API). I had checked other apps that detects wifi hotspot, and I am just wondering if those apps have their own database with all the wifi hotspot information (SSID, location coordinates, etc) so when the wifi sensor detects a wifi hotspot, it will lookup the database and get the information such as location. Also, I was mentioned by a colleague that Google Maps also stores wifi info. Is is true? Cause I couldn't find any info about that.

解决方案

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

这篇关于谷歌地图Android API获取WiFi位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆