Android - It takes long to get a GPS-Signal. How to implement a good GPS provider?

sdev picture sdev · Aug 18, 2012 · Viewed 11.4k times · Source

i wrote an app, that tracks the gps location while jogging. Unfortunately the app needs some time to get a gps signal. When i open other apps like google maps, they are getting immediately the position.

My Problem is: How to implement the gps-provider, so that the app gets as fast as possible a signal.

One idea was, to start a service with the app, so that the provider does some preliminary work. But the tracking-activity is not the main-activity. How can i bind the service in an activity, that does not have started the service? Is this a good idea?

Thanks for reading - and i hope my english is understandable,

Martini

Answer

psubsee2003 picture psubsee2003 · Aug 18, 2012

As I mentioned in my comments, GPS start up is not an instant process. The receiver basically has to know the position of each of the GPS satellites in the constellation in order to calculate it's location. The ephemeris data describes the positions of the satellites to the received and is downloaded from the satellites when the GPS is turned on (and I almost forgot to mention the almanac data, which is also part of the download and describes the orbits of the satellites). Things like downloading from multiple satellites and using the last known position can help speed up this initial process, but you cannot make it "instant".

There are other strategies that can be used to help speed up the location process, especially in cell phones. In addition to the last-known position, things like Cell Tower + Timing positioning (ECID) or Wi-Fi positioning can be used in place of GPS while the GPS is still in the acquisition process.

This link describes some ideas on how to handle locating a mobile phone in android, but the short of it is:

  • check last known position (discard if it is too old)
  • check E-CID position (this is extremely fast, but is a very coarse location)
  • check Wi-Fi position (this can be extremely accurate, but requires WiFi to be on and can sometimes have a large amount of error)
  • finally obtain GPS position