Creating a Service is only relevant if you need to perform long-running operations, or to supply functionnality for other applications. I would not recommend to go for this. You can either create a subclass of android.app.Application<http://developer.android.com/reference/android/app/Application.html>. It will allow you to create your socket controller when the application is created, and ensure that this object will be valid untill the application process is killed by the OS. Or you can simply create a Singleton socket controller, and access it through each of your Activity. Singleton objects must be handled carefully in Android because of the memory management policy of the OS. But if you carefully initialize you Singleton object when application is launched, and destroy resources when it is closed, it works fine. Last option is to use a dependency injection library to avoid managing singleton instances. Have a look at what Roboguice<http://code.google.com/p/roboguice/> offers. It is very powerfull.
Regards. -- 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

