質問

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

役に立ちましたか?

解決

Are you first checking if there is a last known location which you can use? Most apps first check for it and then search for a location.

他のヒント

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
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top