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.

The reason I think this is more efficient would be for power usage
purposes: it seems that running the GPS and Network listeners side-by-
side all-the-time would be a waste of the user's battery... Running
'em side by side would also probably slow down your app just a tiny
bit as you're starting up an extra listener when you may not need to.

-Nick




On Apr 2, 9:41 am, "Maps.Huge.Info (Maps API Guru)" <cor...@gmail.com>
wrote:
> The COARSE and FINE will both be the same if only one location service
> is available, also they will be null if no location service is
> available. What I do is create both, then test to see if they are
> equal and if so, null one out before starting the listeners. One
> problem that could result in this method is if your app is long lived
> and started indoors (network or no location service), then the user
> ventures outside where GPS is available. If you expect this type of
> usage then you'll have to be checking periodically.
>
> -John Coryat

-- 
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

Reply via email to