Wednesday, October 28, 2015

HTTP client vs HttpUrlConnection

Android provides two HTTP clients to perform network operations.

- Apache HTTP client
- HttpUrlConnection


Apache HTTP client
- Large and extensive API's
- Supports cookie handling, authentication and connection management
- Suitable for web browser and other web applications
- Does not support HttpResponseCache mechanism, hence leading to increased network usage and battery consumption

HttpURLConnection
- Light weight HTTP client
- Suitable for mobile applications
- Response caching reduce network use, improve speed and save battery.
- HttpURLConnection supported in Android from GB.
- HttpURLConnection is the best choice for Android.

3 comments: