Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getting response code from HttpURLConnection in android

i am establishing connection with the server and its working fine. But there are times when i try to get the response code (when server is throwing back 401, 403, 404) i am getting IO Exception. I am handling everything based on the response code. So when it throws IO exception on

http.getResponseCode()

i am not able to read the response code. Please suggest a solution for this.

like image 857
Arun Avatar asked Nov 05 '22 07:11

Arun


1 Answers

Prior to android 2.3 HttpUrlConnection has few issues. Its better to use Defaulthttpclient api. Seems your issue is similar to this.

like image 149
manjusg Avatar answered Nov 11 '22 03:11

manjusg