I am looking for a tutorial that explains the logic for fast, robust
location finding.

Basically I am sick of Google Maps finding my location so incredibly
fast and accurately while my own application struggles to get a
location.

I would be fine with pseudo code responses and I will explain what I
am doing so maybe I can be shown what I am doing wrong.

1. Get the locationManager object.
2. Do a 'get best provider' call.
3. Get a list of all available providers.
4. lm.requestLocationUpdates(bestProvider, 0, 0, this);   // hit the
location provider as much as I can to get my first signal
5. Send a delayed message.  If a location cannot be found in 10
seconds, switch to a different provider and try again with
lm.requestLocationUpdates(nextProvider, 0, 0, this);
6. Repeat step 5 until I have a location.
7. Once a location is found determine if it is the most accurate
provider.  If it is not try again with the most accurate provider on
an 8 second delay.  If it is the most accurate provider then set
lm.requestLocationUpdates(currentProvider, 30000, 0, this); to
conserve battery
8. Make sure to lm.removeUpdates(this); before changing the
requestLocationUpdates

Now it occurs to me that it may be possible to iterate through my list
of providers and do requestLocationUpdates for all providers at once.
Is this a viable option or can you only listen to one provider at a
time?  I have seen that location from onLocationChanged has
getProvider() to let you know who provided the location information so
that I can know which provider is actually finding a signal and turn
off the others.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe, reply using "remove me" as the subject.

Reply via email to