I've been researching ways to geolocate a device and found, in summary, these 4 types:
- GPS is the most accurate means of determining positioning, but it is even energy-efficient than other options and sometimes requires a long start-up time.
- A-GPS (assistance GPS) uses triangulation between cell phone towers and public poles to determine location. While not as accurate as GPS, GPS-A is sufficient for many scenarios.
- Mobile devices that support Wi-Fi hotspots can use hotspots to determine the user's location.
- Stationary computers without wireless devices can obtain approximate location information using known IP address ranges.
GPS, A-GPS and IP I understand the whole process. But when I try to understand geolocation through Wi-fi, it's not clear to me, after it processes my local network signal, what does it do next: send data via GPS? Or does the system infer positioning by IP? Do you use A-GPS?
Looking at the W3C Geolocation API, I can know the data received, but I don't know how it captures (all notebooks and smartphones have dedicated hardware) this information.
To help make a more precise location, the Wi-Fi comes in!! When Google's cars took to the streets to capture images for Street View , they also began capturing data from every wireless network they found. Mainly name, MAC Address (it is a numerical code that in theory would uniquely identify each equipment) and signal level. This has generated in many places a huge discussion about invasion of privacy. As the overwhelming majority of Wi-Fi routers have a short range signal (about 100 meters under ideal conditions), it is possible to know where the user is with some precision if there are several routers! Just check the signal of each one of them and do the process analogous to the A-GPS.
In this way, by pairing A-GPS with Wi-Fi it is possible to obtain a much more accurate initial location, until the satellites of the GPS system are found. And this information, even if inaccurate, also helps to locate satellites faster, as this way the device knows exactly which satellites are in your region and searches only for them (by consulting a remote database).
And here comes one more detail on how this information collection is done. It's not just through Street View cars, but users themselves collaborate with it by enabling GPS on their device on first access.
Read more in this article Why does Android ask to turn on Wi-Fi when accessing GPS?