Android GPS Investigation

In an effort to improve icecondor's usage of the GPS radio in android phones, I made a simple GPS activity log.

The concept behind IceCondor is simple, take a GPS reading every X minutes and send it to a webservice. The number of minutes between readings is configurable. The Android interface to the GPS is fairly hands-off. There is no GPS on and off button. An app makes or removes a request to the operating system get a reading every X milliseconds. What actually happens and its effect on GPS radio usage is interesting and not necessarialy obvious.

Lets say the app requests a location update every 60 seconds.

  • 1. a GPS fix occurs in 15 seconds. The radio is on for 15 seconds. Once a fix has been made, the first peculiarness with GPS readings occurs: the app will get straifed with a handful of updates because earlier updates come faster with less accuracy and later updates come later with more accuracy. So the app has some chance in deciding what accuracy it is interested in. Total GPS radio on time: 30 seconds or so
  • 2. a GPS fix is unavailable. Android will turn on the GPS for 60 seconds, looking for a lock. It then turns the radio off for 60 seconds and repeats. I observed the phone do this for 12 minutes.

Using the location update request at 0ms and cancelling the request gives good control over the GPS being on or off. Basically I'm interested in knowing if a fix is available within 20 seconds and if not, dont try any further. If a fix comes within 20 seconds, continue to get updates for the next 10 seconds or until the accuracy gets to 32m, whichevery comes first. I beileve this can be implemented with the 0ms update request working like a GPS on/off function, and using a 20second and 10second timer thread to mark when the next step should happen.

From what I have observed, if I am in a building, leaving the radio on for a couple minutes is useless. Either I am in a GPS coverage area or not. So a 20 second attempt every X minutes should be good for on-person, continuous (24hour/day) location tracking.

tags: