Reputation: 1330
Now that the entire org.apache.http
APIs are deprecated, it seems like that I should be using java.net
API instead.
Hasn't it become more complicated to code?
Upvotes: 0
Views: 250
Reputation: 1007564
Why were the entire HTTP APIs in Android deprecated in API level 22?
Google had announced a couple of years earlier that they were no longer maintaining their edition of Apache's HttpClient. Android 5.1's deprecation and Android M's removal of HttpClient simply reinforces this.
Hasn't it become more complicated to code?
You are welcome to
consider switching to
OkHttp and their HttpClient
compatibility layer, or consider switching to
Apache's separate Android edition of HttpClient.
Otherwise, consider OkHttp's native API. Or, use dedicated
APIs for things like REST-style Web services (e.g., Retrofit) or image loading
(e.g., Picasso, Universal Image Loader). Any of those would be viable alternatives to HttpUrlConnection
, if you do not like that API.
Upvotes: 1
Reputation: 1249
-> Apache HTTP client has fewer bugs on Eclair and Froyo. It is the best choice for these releases.
-> For Gingerbread and better, HttpURLConnection is the best choice.
Its simple API and small size makes it great fit for Android. Transparent compression and response caching reduce network use, improve speed and save battery. New applications should use HttpURLConnection; it is where we will be spending our energy going forward.
Please visit this link for details.
Upvotes: 0