Developer Magnus Eriksson has created what he calls an Android location service data dumper. This is an app that searches Android phones for a location data file similar to the one iPhones use to store location data.
Following the latest days internet outrage/overreaction to the revelation that iPhone has a cache for its location service, I decided to have look what my Android devices caches for the same function.
This is a quick dumper I threw together to parse the files from the Android location provider.
The file contains what he refers to as ‘coarse’ location data. That is to say data obtained by cellphone tower location and not a more accurate GPS data location.
Here is a sample set of data from the cache.cell file that records cellular locations in the Android file system. You can see that it contains a set of entries that record a latitude and longitude as well as a time stamp.
$ ./parse.py cache.cell
db version: 1
key accuracy conf. latitude longitude time
240:5:15:983885 1186 75 57.704031 11.910801 04/11/11 20:03:14 +0200
240:5:15:983882 883 75 57.706322 11.911692 04/13/11 01:41:29 +0200
240:5:75:4915956 678 75 57.700175 11.976824 04/13/11 11:52:16 +0200
240:5:75:4915953 678 75 57.700064 11.976629 04/13/11 11:53:09 +0200
240:7:61954:58929 1406 75 57.710205 11.921849 04/15/11 19:46:31 +0200
240:7:15:58929 -1 0 0.000000 0.000000 04/15/11 19:46:32 +0200
240:5:75:4915832 831 75 57.690024 11.998419 04/15/11 16:13:53 +0200
The file is only accessible on devices that have been rooted and opened up to installation of unsigned apps. This is similar to the way that the iPhone used to store the data before it was made available to developers using the iPhone’s background API for location sharing.
Now however, the iPhone data is exposed to casual access using an application called iPhone Location Tracker that is similar in intent to the app that Eriksson has created for Android phones.
We spoke to Eriksson about the way that the data from the Android OS and from iPhones is being used by their respective creators. He explained that when an application requests location information, it doesn’t always need a pinpoint spot so the OS just uses cell towers to get a general location.
The phone then sends the cell tower info to Google and in return gets a set of coordinates.
Then it can use this info (via triangulation and weighting based on each cells towers signal strangth etc) [to] get a rough estimate of it’s location.
This is corroborated by Adam Swindon, the creator of the CDMA version of the iPhone Tracker, who says that the data from a separate field within the Apple location data file, LocationHarvest, points to the possibility that the information is sent periodically to Apple.
I think the names of the tables could be another clue towards how the data is being used. I have only ever seen the harvest tables containing a few entries with very recent timestamps, therefore they might be used as a queue for data to be sent to Apple. Once sent it could be archived in the other table, and the harvest table cleared.
Due to the strong evidence that this behavior is extremely similar between the Android and iOS operating systems, it’s likely that the inclusion of months worth of this data is an oversight or error on Apple’s part and not intentional. Instead it’s likely that the Apple system was originally intended to behave the way that Google’s system does.
This is the behavior that John Gruber has speculated was the initial intent of Apple in regards to how long they keep location data in their system.
After a period of time, 12 hours for cellular data and 48 hours for WiFi data, has passed, the location data is renewed by a new request from Google. It is also limited to a maximum number of entries so that the database doesn’t grow too large.
Swindon says that the location file pulled from his phone contained roughly 13,000 entries related to cellular network tracking. By contrast the Android file is limited to only 50 entries in the cellular location database.
The size of the database on the iPhone is what Eriksson attributes the accuracy of the location maps created by the iPhone location data file to. Normally the data would be much more crude, but with a lot more data sampling to work with, the map grows more detailed and more accurate.
This means that the only reason that the Apple system yields such detailed results is that it has far more data than it’s supposed to have in it’s database.
Why that system does not behave the way that the Android location recording system does and simply dump out older entries is a mystery at this point. Gruber points to unofficial channels to suggest that it is a bug that will be corrected and looking at the evidence, we tend to agree.