Hey guys-

Thanks again for the feedback. My app has two reasons for knowing the
location: the first is to fetch data from a web API when the app
loads, this one does not need a super-accurate location fix as I'm
initially fetching a large enough radius of data to make any 10,000
meter error negligible. The second part is when the user selects a
spot on the map, it displays a "Distance from you" in miles, this one
I would like to be as accurate as possible [meaning if GPS is on, I
should be trying to get an update from it and hoping for one
eventually so this data is actually useful].

So when the app launches I'm killing updates after the first one
[regardless of whether its GPS or NETWORK] and using those coords to
fetch data. Then after the fetch I push to a new activity, turn back
on the listeners and hope GPS eventually gives me a fix.

John: you mention if the user is on WiFi, that doesn't take them off
the Network does it? That wouldn't make sense as the user would no
longer be able to make a call... Shouldn't the phone still be able to
triangulate based on cell towers even while on a WiFi network? Also,
you say I won't even know the availability of GPS for up to 30
seconds? So that means onStatusChanged() won't be fired, not even with
a TEMPORARILY_UNAVAILABLE, until up to 30 seconds at times? If this is
the case, I will definitely switch to your method of running them side-
by-side.

Bob: my app is localized to a few major metropolitan centers [and more
to come], but there's no real application for it in rural areas.

-Nick




On Apr 4, 1:26 pm, Bob Kerns <r...@acm.org> wrote:
> I should have said to opt for the simplest thing that actually works!
> Or, to put it another way, "as simple as possible, but no simpler".
>
> (Neither phrase is mine, but I can't recall the correct attributions.)
>
> For the fastest result, I'd start off with both listeners. The network
> will nearly always win (unless you're off the grid), but the GPS won't
> start until you ask it to.
>
> However, even if you can't get a network fix, you MAY be able to get a
> GPS fix, eventually. It will certainly take longer in this case. I
> haven't tested it in a location far enough away from towers to not get
> any network fix at all, and it would vary by phone anyway, but in
> theory it should be possible.
>
> Handling this case may not be important. A long-delayed GPS fix may be
> useless, for example. So as Maps API Guru says, you'll have to decide.
>
> On Apr 4, 3:00 am, patbenatar <patbena...@gmail.com> wrote:
>
>
>
> > Bob- You're absolutely right. The phone will continue to be a phone,
> > so the Network listener really isn't an energy consumer as its always
> > connected to towers. Great analysis, thanks! You say simplicity is
> > probably the best approach here--my main goal is to get a location as
> > fast as possible, whether it be network or GPS, then hope we can
> > eventually get a GPS update, but without one it will be OK.. Do you
> > think my approach will be just as fast as running two side-by-side
> > listeners?
>
> > Ning- This isn't really a concern for me as the lifetime of my app is
> > not very long.. I couldn't imagine a user running my app in the
> > foreground for a day or so as in your application.
>
> > Thanks for all the feedback, you guys are great help!
> > -Nick
>
> > On Apr 3, 5:21 pm, Ning <zeeg...@gmail.com> wrote:
>
> > > On Apr 3, 2:39 am, patbenatar <patbena...@gmail.com> 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 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