Mark,

I have tried moving the start Service call to a manually-managed thread
within the Activity, but with the same results. The UI Thread still hangs
when the Service attempts to connect to an invalid server.

Agus,

In the Service, I instanciate a Connection object from which the
class extends a Thread. It's in the constructor of that the Connection class
where I create a new Socket. Everything works properly when I feed that
constructor a good IP and Port, the problem arises when I force that Socket
to throw an exception. It seems like it takes longer than the
ActivityManager is willing to wait for the exception to be thrown.

I have no problems binding in the Application Context, when the Service
starts up normally.

Thanks,
J

On Fri, Apr 9, 2010 at 7:29 AM, Agus <[email protected]> wrote:

> Have you tried launching a thread inside your Service and have your Service
> binded/started in the Application context?
>
>   On Fri, Apr 9, 2010 at 5:23 AM, Jason LeBlanc 
> <[email protected]>wrote:
>
>>   I have a scenario where I start a Service from a splash screen. If I
>> intentionally cause problems in that Service (such as an invalid port for
>> the Socket connection) my UI Thread locks up. I have put a Timer in the
>> Service, and have it perform logging at every tick. The Timer works from
>> within the Service without flaw. So from that, I think I have determined
>> that only the UI Thread is suffering.
>>
>> If I start a Service from an Activity and that Service has an issue (i.e.
>> server connection problems), should that result in a lockup in the UI thread
>> from which it was launched?
>>
>>  Is there a technique for starting a Service and having it truly run in
>> the background?
>>
>> Thanks,
>> J
>>
>> --
>> 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]<android-developers%[email protected]>
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>>
>
> --
> 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]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

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

To unsubscribe, reply using "remove me" as the subject.

Reply via email to