Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTPUrlConnection vs HTTPClient what is the functional difference between these two

So i am a newbie to android.i am very much confused right now.tell me what is the difference between HTTPUrlConnection and HTTPClient And which is preferable while fetching the data from web

like image 991
dibya ranjan mishra Avatar asked Oct 11 '25 14:10

dibya ranjan mishra


1 Answers

HttpClient is deprecated and should not be used for any new applications. HttpUrlConnection was originally meant to be it's replacement, it has fewer apis but is smaller and more lightweight. However, some attractive competitors have emerged for HttpUrlConnection, including okHttp, Retrofit and Volley (from square and google respectively).

Unless you have some specific needs from the library (intercepting requests and modifying the headers for example), I would recommend going with okHttp as it has a larger community and is more robust.

This SO post and search which-android-http-library-to-use do a good job describing your options.

like image 188
Dr. Nitpick Avatar answered Oct 14 '25 03:10

Dr. Nitpick



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!