Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

I read that android (and simmilar operation sytems e.g. iOS) get the current coarse location by using either WiFi or GSM tower triangulation. I get the basic idea but have questions about the details.

  1. Does Android normally use both methods or does it prefer one and fall back to the other?
  2. Does it comunicate with a server to get the position via WiFi? (e.g. sending the SIDs of the WiFis to a webservice)
  3. Does it communicate with the Carrier to get the position via the GSM towers or is this done on the device?
share|improve this question
add comment

4 Answers

up vote 6 down vote accepted

It is really up to the developer as to how to implement the location service. The full description is available here:

http://developer.android.com/guide/topics/location/obtaining-user-location.html

The graph about 1/3rd down the page is pretty useful to see what a typical app might do, but again, it is completely up to the app developer. The location service types are:

  • Cached Fix
  • Cell-ID
  • WiFi
  • GPS
  • Mock Location

If the app requests permission for coarse location only, it will not use the GPS to determine location.

To answer your questions...

  1. It is up to the individual app developer, but in most cases the sequence will be Cached Fix, Cell-ID, Wifi, GPS, in that order.
  2. Yes, after acquiring the tower IDs or SSIDs of the WiFi signals, that data is transmitted to Google to determine a rough location.
  3. No, Google has done something really clever here. Google has their own database of cell tower locations, and does not require an interaction with the carrier to determine the location of the tower.

This article has some of the detail http://franciscokattan.com/2010/02/06/dynamic-cell-id-clever-way-to-block-google-but-will-it-backfire/

The short version is that, when you use an app like Google Maps, the app will send the current Cell-ID information back along with your current GPS fix. In this way, Google gets a very good sampling of the signal strengths in various locations, and is able to build a very rich database.

share|improve this answer
    
I like your answer pretty much, but I'm not sure if your right on the "it's totally up to the developer"-part. As far as I can tell, the developer can only decide to get the fine or the coarse location. In other words he can use the LocationManager.NETWORK_PROVIDER and/or LocationManager.GPS_PROVIDER to obtain the location. I think he can not decide or even see, if Wifi or GSM is used, right? –  Tim Büthe Sep 29 '10 at 10:25
    
In the most common case, the developer will not care if the data is coming from WiFi or Cell-ID, but the dev could put in restrictions to only allow the app to work when WiFi is disabled or GPRS/GSM is disabled. I took your question to mean: "Is there a standard sequence that all apps follow" and the answer to that is no. However, with specific regard to the difference between WiFi and Cell-ID, the app developer has limited capability to specifically request one type of location service. –  JadeMason Sep 29 '10 at 13:43
1  
do you know a way to submit Wi-Fi hotspots' location to their database so that I will have a better triangulations in my neighborhood/indoors? I have opened a thread for that questione of mine: android.stackexchange.com/questions/4715/… –  Comptrol Jan 14 '11 at 9:20
add comment

You phone knows what the closest towers are. There is a provider database for each country which tower id is located where on the map. This database might be small enough to be preinstalled by your provider or supplied over the air. How an android phone gets this data I don't know.

share|improve this answer
add comment

I have slightly different answers for #3 : the device could be used if you want to use triangulation, but you need to use the carrier if you want to match the Cell-ID and the localization of the gsm (or cdma) tower.

share|improve this answer
    
but is this an option that can be determined by an app developer or even an end user or is it something that is determined by the carrier? –  Matt Sep 27 '10 at 20:59
    
It is mandatory, if you want to use this way for localizing a device. Using triangulation or another method allows you to know where you are versus antenna position. But if you don't know the lat/long of the antenna, you won't be able to get your position on a map. I home I'm clear :) –  Rob Sep 28 '10 at 7:43
    
@Rob But you don't need the carrier to find the location of the tower. Each tower broadcasts a unique ID, anyone can independently pick that up and map it, with no carrier interaction. Google have been doing this for a while for cell towers and WiFi access points. The Google Streetview car picks the info up as it travels, and users of Google Maps on various platforms also send back anonymous data matching GPS fixes with antenna and wifi IDs and strength. This is similar to how Google pick up a lot of their traffic data in cities, they aggregate speed and positions from lots of Maps users. –  GAThrawn Sep 29 '10 at 10:28
    
Are you sure ? Looks surprising. For instance, in Germany (and other countries in Europe), Google has been sued for collecting wifi information, so looks like they did not use this resource. For the GSM database, if Google owns one, it should be accessible, and I never heard about it. –  Rob Sep 29 '10 at 13:40
1  
@Rob googlemobile.blogspot.com/2008/06/… "The phone knows the ID of the cell tower that it's currently using. If the phone has GPS, the Maps application on the phone sends the GPS coordinates along with the cell ID to the Google location server." can't find the link right now but they announced a while ago that the Blackberry Google Maps app was sending back nearby WiFi SSID and strength for the same reason. This isn't the same as the programming "error" in the Streetview software they're being sued over that captured more WiFi data than it was meant to. –  GAThrawn Sep 30 '10 at 11:39
show 2 more comments

A lot of this is carrier specific and I'm not a dev but heres what I could piece together from the interwebs and the trainings I've had in electronic crime investigation:

  1. Yes but it depends on the specific apps LBS priorities which are set by the dev and can be based on current course accuracy, power levels, predefined priorities...
  2. Yes. The carriers have proprietary Wifi base station location DBs.
  3. I can't speak to Android specifically, but generally this is going to be carrier and network type (CDMA or GSM). Phones are capable of both but at least a few years ago they did this work on the handset because of the bandwidth constraints of doing it ota.
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.