3

I have used the LocationManager before and it turned out to be fine. More, there are a bunch of projects on code.google.com which contain some nice code snippets.

The request:

  • track a car in the city

What I've got

  • a minDistance to initialize the providers with
  • a maximum accuracy
  • use the network location provider first

How I thought of things

Well, the main request, because the car is always in a city area, is to use network location. Both because of battery use and because of pretty high accuracy in cities.

However, if the location retrieved from the network provider has an accuracy over the limit, then GPS needs to be fired up to read the location. Here's where the fun part starts and there are a few things which are unclear.

There are two possible ways I see:

  1. Every time the network location accuracy is over the limit, enable updates for GPS and on first position fix, remove updates and continue with the network provider again.

  2. Enable updates for GPS and keep the GPS on for some time (like 10 minutes) to work in parallel with network and choose between the two, which location is more accurate. This could be tricky to achieve as readings are made independent.

I wonder in case of disabling GPS after a location retrieved, how is it in terms of battery and locking time, to enable it again. Basically, having a lock once, will help getting new lockings faster? Enable/Disable over and over again will consume more battery than keeping GPS on all the time?

Isn't there an option to just "give me best location right now, independent of provicers"?

Octavian Helm
  • 39,405
  • 19
  • 98
  • 102
Alin
  • 14,809
  • 40
  • 129
  • 218

1 Answers1

0

This is the best post about what you want to do which uses the enabled providers then get the best provider from them.

Community
  • 1
  • 1
Hesham Saeed
  • 5,358
  • 7
  • 37
  • 57