> You probably DO want to turn off GPS onPause() though - you don't want
> your
> app to drain the user's battery needlessly getting location updates when
> you're not doing anything with it. Just make sure to turn it back on in
> onResume() as necessary.

Considering how long it takes to re-establish GPS, depending on the app,
I'd be inclined not to stop it in onPause(). Rather, I'd look at using a
Timer or postDelayed() or something from onPause() or onStop() to fire
after a minute or so, *then* shut GPS down if the activity has not
returned to the screen. That way, if this is a short interruption, you
won't have the user have to sit and wait.

Of course, in onPause()/onStop(), I'd also check isFinishing() and shut
GPS down for good if the activity is surely going away.

Those ideas are just off the cuff, though -- I haven't written a
production-grade location-aware app, so I haven't worked through all of
the ramifications yet.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
Android App Developer Books: http://commonsware.com/books.html


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

Reply via email to