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



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