简体   繁体   English

Google映射Android API获取wifi位置

[英]Google maps Android API getting wifi location

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). 因此,我正在开发这个应用程序,通过使用手机的传感器wifi检测它将获得wifi热点的位置(手机实际上并没有连接到热点wifi,它只是检测到)。 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. 在开始开发应用程序之前,我正在进行一些初步研究,似乎Google Geolocation API将为我完成这项工作。 However, it is not free (at least what I understood after reading through the API). 但是,它并不是免费的(至少我在阅读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. 我检查了其他检测wifi热点的应用程序,我只是想知道这些应用程序是否有自己的数据库,包含所有的wifi热点信息(SSID,位置坐标等),所以当wifi传感器检测到wifi热点时,它会查找数据库并获取位置等信息。 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: Android有多个LocationProviders,包括:

  • LocationManager.GPS_PROVIDER : get position using GPS LocationManager.GPS_PROVIDER :使用GPS获取位置
  • LocationManager.NETWORK_PROVIDER : get position using Wifi, cell network, etc. LocationManager.NETWORK_PROVIDER :使用Wifi,手机网络等获取位置
  • LocationManager.PASSIVE_PROVIDER : get position using data provided by already running providers. LocationManager.PASSIVE_PROVIDER :使用已经运行的提供程序提供的数据获取位置。 This allows several apps to share geolocation information) 这允许多个应用程序共享地理位置信息)

You don't have to pay anything to use NETWORK_PROVIDER 您无需支付任何费用即可使用NETWORK_PROVIDER
Some providers might not be present on all devices, depending on phone model and android version. 某些提供商可能不会出现在所有设备上,具体取决于手机型号和Android版本。

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.) 提供商有不同的特点:网络速度快但不总是足够精确,GPS精确但速度慢,电池密集等。最好的策略是从多个提供商处请求位置,并在获得良好的位置时立即取消待处理的请求足够取决于您的标准(精度,响应时间等)

I found this article by Reto Meier quite useful to wrap my head around geolocation on Android 我发现Reto Meier的这篇文章非常有用,可以帮助我解决Android上的地理位置问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM