On Apr 3, 2:39 am, patbenatar <[email protected]> wrote: > Hey all who are interested in this topic- > > I have taken John's above advice and modified it into what I believe > is a more efficient way to be doing this [although the efficiency of > my method is only evident if you're going to to ensure updates from > either provider throughout the life of your app]. Please let me know > your thoughts on this method: > > Rather than running both listeners side-by-side as John suggested > above, I am first running a GPS listener and then within that > listener's onProviderDisabled and onStatusChanged [only if the status > is OUT_OF_SERVICE or TEMPORARILY_UNAVAILABLE] I am requesting updates > from a Network listener [and of course setting a networkOn=true flag > so I don't turn it on twice or anything]. Then the Network takes over > [while GPS listener remains running] until onStatusChanged() in the > GPS listener gets an AVAILABLE status at which point I turn off the > Network listener [and mark the flag accordingly] and allow the GPS to > do its thing.
Apparently, my reply didn't go to the public list because I habitually hit 'a' when I tried to reply all in Google Groups, which does not do the job. I have been using this approach for a while. There are two problems with it. The first one is that GPS takes a while to get the first fix. The second one is power consumption. My program is set to get update every 5 minutes or 200 meters. After a day or so when I checked the battery usage, it had raised to the top of the list, consuming some 30% of all power consumed during that period. So I switched to using network location only, and my program disappeared from the list. So my opinion on this is that unless absolutely necessary, I won't use GPS as location provider frequently. It will drain the battery very fast. -- Ning -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] 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.

