There is something messed up with your HttpClient object. That
exception is being raised by HttpClient itself, based upon what I can
see in the Android source code.

Bear in mind that, in the case of an alarm, your process hopefully was
terminated/recycled since the last alarm, and so there is little value
in attempting to reuse some global HttpClient here. I'd just create a
new one.

Also, bear in mind that all IntentServices do their work on a
background thread, and HttpClient is not thread-safe by default. It's
possible this error is tied to that. You need to hook up a
ThreadSafeClientConnManager to the HttpClient object if you will reuse
it across multiple threads.

On Sun, Oct 31, 2010 at 2:14 AM, Julius Spencer <jul...@msa.co.nz> wrote:
> Hi,
>
> I'm trying to send an HTTP request from a WakefulService so a Service which 
> has been started from an alarm set up with AlarmManager and I get the error:
> IllegalStateException: No wrapped connection.
>
>        HttpGet httpGet = (HttpGet) new 
> HttpGet(MYRequestHelper.getRequest(this));
>        HttpClient client = ((MYApplication) getApplication()).getHttpClient();
>
>        String response;
>        try {
>                response = client.execute(httpGet, new BasicResponseHandler());
>
>
> At this point I run through parsing JSON and creating new HttpGets and 
> executing them on the client.
>
> Is it possible I running execute too many times on the client or something?
>
> I'm don't really understand what the error means and I haven't been able to 
> glean anything much from Googling other than to catch it and hope for the 
> best.
>
> Cheers,
> Julius.
>
> --
> 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
>



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android 2.2 Programming Books: http://commonsware.com/books

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