[android-developers] Re: socket sharing

2012-07-27 Thread RichardC
Probably better to use a service. On Friday, July 27, 2012 6:34:11 PM UTC+1, bob wrote: > > Is it possible to pass an open socket between different Activities in the > same Application? > > > Is this a reasonable practice or no? > > > -- You received this message because you are subscribed to t

Re: [android-developers] Re: Socket sharing between activities

2012-04-19 Thread Federico Paolinelli
Can't say what's happening, but: if you "took inspiration" from there, you are creating the service as "auto_create", which means that it stays around unless there are no bound activities anymore. Assuming that you are unbinding it on the onDestroy, the thread contained in the service may be still

[android-developers] Re: Socket sharing between activities

2012-04-19 Thread Tonez
Hi guys, Thanks to everyone for the prompt responses. I've studied up on Services / IntentServices as well as how I would go about using a Singleton to satisfy my goal and have decided to give both a try to take the experiential learning route. I've started with Services and have managed to get

Re: [android-developers] Re: Socket sharing between activities

2012-04-18 Thread Federico Paolinelli
Thanks again for the clarifications. Federico On Wed, Apr 18, 2012 at 1:26 AM, Dianne Hackborn wrote: > On Tue, Apr 17, 2012 at 12:03 AM, Federico Paolinelli > wrote: >> >> Not using a service will make the connection "available to be killed" >> if the application goes background. >> Is th

Re: [android-developers] Re: Socket sharing between activities

2012-04-17 Thread Dianne Hackborn
On Tue, Apr 17, 2012 at 12:03 AM, Federico Paolinelli wrote: > Not using a service will make the connection "available to be killed" > if the application goes background. > Is that correct? > Yes. > And, if we want to close the connection when the application is no > longer visible, where shoul

Re: [android-developers] Re: Socket sharing between activities

2012-04-17 Thread Federico Paolinelli
Thanks Dianne for the clarification. I always thought that every task should have been performed in a native android component, was it an activity or a service. I am quite curious about this topic. Now, let's assume that his application does not need to fetch the data while in background, and that

Re: [android-developers] Re: Socket sharing between activities

2012-04-16 Thread Dianne Hackborn
You don't need a service. And please please don't use startService() unless you really want to use up the user's resources with your app trying to run when they are not in it. Way too many apps I see abuse resources and keep themselves running in the background and thus just sucks. Just make a s

[android-developers] Re: Socket sharing between activities

2012-04-16 Thread Federico Paolinelli
Another approach that you could follow is to host the tcp connection inside a service (http://developer.android.com/reference/android/app/Service.html) You can then access the service from any activity you want using the binding pattern or through intents. Just remember that your app may continu