> ... > It's a static reference, ie global to the process. So as activities > are started the ref points to the new activity. > > That said, I agree the right thing to do here isn't obvious. But it's > also not obvious to me why you think it's bad to unregister the > listener in your apps onDestroy. I am skeptical battery life would be > that badly harmed?
If GPS keeps running for no reason when the user is on the home screen, users will complain, and rightfully so. GPS is probably the largest battery sucker on Android. Anyway, I guess I'll just stick with my hack, it works well (although I hate that I have to call it in EVERY SINGLE activity the user could potentially exit the app from). Frankly, I already thought about putting together a library with support classes that take care of all those things. I more and more find myself writing boilerplate code for things that really should already be handled by Android... best example is long running operations support (threads spawning from a context), which is very difficult to get right on Android with all the lifecycle states your app can be in, but that's a different story. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---