Android where i am

Without GPS, how does Google and Android know where I am

Simplified diagram of the messages passed during a network location lookup

in Gecko SMS. The messages are usually passed purely inside the phone

with cached data, sometimes over the Internet

Gecko SMS and many other applications are dependent on knowing the location of the phone they are running on. The usual way for a device to get its location is using GPS, Global Positioning System, but this can be slow, use a lot of battery, and is sometimes totally unavailable; especially indoors.

ads

Android where i am

But Gecko SMS for Android phones works really well even when GPS is turned off or not available. How is this possible?

The answer is "network location", which is a method based on either the mobile or WLAN networks that the phone can detect. Basically each cell (i.e. tower, base station) in a network has a unique ID*, so it is possible to build a list of all the IDs and their coordinates. Mobile phones are always connected to some network cell**, so to get the location or the phone, one can look it up from this list based on the current cell ID.

The tricky part is getting a list of all the mobile network and WLAN cells in the world, with their coordinates. Mobile operators do not usually publish the locations of their towers, and there is no central list for wireless network routers either. This means that someone must physically go to all possible places and record the IDs using some kind of a device. This is where big companies have great advantage, and for example Google has two major ways for doing this. The first one is by crowd sourcing: Everyone that uses Google Maps on a mobile phone with GPS enabled is also feeding back network data to Google. This is quite brilliant and works well: the phone needs to contact Google servers to get the maps, so there is little overhead for also gathering the network data. It also means that for Google Maps, network location is really reliable in all the areas where they have active users. The second method that Google uses is data collection by their Street View cars that drive around many countries. In Europe, there was some controversy about this as the cars accidentally collected a bit more data from the WLAN networks than just network IDs.

Android where i am

Such a list of ids and locations for each cell in the world is too big to be stored in a phone, and needs to be constantly updated, so the full data is stored on servers. The phone uses normal mobile internet connection to get the relevant locations from the server when it needs them, and stores these for later use.

This whole solution from Google is built into the Android platform, so all Gecko SMS needs to do is use the provided APIs and it can almost always get a location to work with. Pretty neat!

Also other new smartphone platforms have similar functionality built-in, but this has not always been the case. Last year when we built a prototype of Gecko SMS for the older S60 Symbian platform, we had to deal with the cell ID lookups and related database queries in our own code. Simple HTTP requests, but nevertheless tedious to get right especially when network connections and location tables are not 100% reliable.

Network cell IDs are not a foolproof way of getting a location. As networks change, there is a chance that the list of locations for the cells is outdated. I noticed this first hand a few months ago when I moved house: my WLAN router had physically moved, but still had the same ID as before. Thus at my new place, all my test phones were giving the location to my old place. This continued until I renamed the WLAN, so Google picked up the change. These kinds of incidents however are rare enough that it basically "just works".

Android where i am

Another limitation is that especially for GSM networks, a single network cell covers a wide area, so the location defined by it is quite inexact. GSM cell location is accurate to about 200-3000 meters, whereas WLAN and WCDMA (3G) cells can provide an accuracy of 50 meters or even less. This inaccuracy is something that has to be handled on the application level. In the case of Gecko SMS, the application learns the users choices and can automatically single out the exactly correct landmark even from inexact location information.

*) That was a bit simplified: For GSM/3G networks this ID contains Mobile Country Code, Mobile Network Code, Location Area Code, and Cell ID. For CDMA it is System Identification number, Network Identification number, and  Base Station ID  (SID, NID &  BID ). For WLAN networks it is the MAC address and network identifier (SSID).

Related posts

  • The Best Ereader for Android Reading ebooks on Android used to be just okay. Now it's awesome. While there are plenty of sweet apps for reading books on your phone or tablet, Play Books has...

  • Video: Hands-on With New Instagram Video on Android Not that it was much of a surprise after a couple of reports broke the news in the days leading up to today’s Facebook event, but yes, they...

  • 4 Pics 1 Word Answers & Cheats 4 Pics 1 Word answers, cheats, and hints will show you how to beat all levels and letters of the game for iPhone, iPod, iPad, and Android. Guess the word that the...

  • Minecraft: Pocket Edition (for Android) Solid mining and crafting experience. Looks and plays great. Dead simple multiplayer. Continuous development. Not as deep as the PC version. Some touch...

  • [Android] What Is Superuser Gaining root on an Android device is not attained by unlocking the bootloader, or installing a custom recovery, but by flashing a small file called superuser....