On Jun 9, 1:02 pm, "Mark Murphy" <[email protected]> wrote: > > I have an app that has some network connections that are causing > > issues when the app closes/reopens. I would like to close the > > connections when the app exits, and reinstantiate them when it opens > > again. onCreate/onDestroy don't work for this purpose because they > > get called for the foreground activity in other situations, such as > > when the keyboard slides out, and the rapid succession of these calls > > make it impossible to reliably tear down/reopen the connections > > without running into race conditions. How can I tell when the app has > > exited? Is there a better way to deal with network connections? > > Put them in a service, which is unaffected by the comings and goings of > individual activities. > > -- > Mark Murphy (a Commons Guy)http://commonsware.com > _The Busy Coder's Guide to Android Development_ Version 2.0 Available!
Yes, but when the app closes I want to close the connections (which requires sending data - not just releasing the objects) regardless of what's holding them. How can I tell when the app exits? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

