APACHE HTTP CLIENT AND HTTP URL
CONNECTION FOR ANDROID:
Http client and HttpUrlConnection
both are used to make connection over HTTP to communicate through server in
android. From android M (6.0) apache http client is officially deprecated from
android and from gingerbread (2.3) it is suggested to use HttpUrlConnection instead of HttpClient
.
Quote from android official site “Android 6.0 release removes support for the Apache HTTP client. If your
app is using this client and targets Android 2.3 (API level 9) or higher, use
the HttpUrlConnection
class instead. This API is more efficient because it reduces network use
through transparent compression and response caching, and minimizes power
consumption.”
HTTP CLIENT:
Http client project represents an effort to provide an
implementation of Apache HttpClient, which can be deployed on Google Android in
parallel to the outdated version shipped with the platform while remaining
partially API compatible with Apache HttpClient 4.3.
There is few changes that has to be different from the stock
version of apache HttpClient and android version of apache HttpClient.
1.
Compiled against HttpClient 4.0 APIs.
2.
Commons Logging replaced with Android Logging.
3.
Base64 implementation from Commons Codec
replaced with Android Base64.
4.
Android default SSLSocketFactory used by for
SSL/TLS connections.
There is few things about http client that is good for web
browser but it is not as good as for android.
Android operate on small devices there for it require less battery
consumption, small API for memory purpose etc.
1.
Large and extensive APIs
2.
Supports cookie handling, authentication and connection
management
3.
More suitable for web browser and other web
applications, because of its large size
4.
Does not support HttpResponseCache mechanism,
hence leading to increased network usage and battery consumption.
HTTP URLCONNECTION:
HttpUrlConnection is a light weight HTTP client, used to
access network resources, and hence, suitable for mobile applications and recommended
by Google to use HttpUrlConnection, instead of the other HTTP clients.
According to google blog “Apache HTTP client has fewer bugs on
Eclair and Froyo. It is the best choice for these releases. For Gingerbread,
HttpURLConnection is the best choice. It’s 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.”
Advantage of HttpUrlConnection that is useful for android
1.
Light weight APIs helps in easier management and
reduces compatibility issues.
2.
Automatic handling of the caching mechanisms,
with the help of HttpResponseCache.
3.
Reduces the network usage and also, the battery
consumption.
Clear explanation. Nice blog
ReplyDeleteDiyarbakır
ReplyDeleteSamsun
Antep
Kırşehir
Konya
A5ZİJ7
ankara evden eve nakliyat
ReplyDeletemalatya evden eve nakliyat
antep evden eve nakliyat
giresun evden eve nakliyat
kayseri evden eve nakliyat
L3PSU
30E72
ReplyDeleteYozgat Lojistik
Bursa Lojistik
Bolu Evden Eve Nakliyat
Çorum Evden Eve Nakliyat
Kastamonu Parça Eşya Taşıma
36EC2
ReplyDeleteZonguldak Evden Eve Nakliyat
Burdur Evden Eve Nakliyat
Van Parça Eşya Taşıma
Etlik Fayans Ustası
Adıyaman Şehirler Arası Nakliyat
Burdur Şehir İçi Nakliyat
Karapürçek Parke Ustası
Karabük Parça Eşya Taşıma
Antalya Lojistik
13DEC
ReplyDeleteÇorum Şehir İçi Nakliyat
Siirt Şehirler Arası Nakliyat
Konya Şehir İçi Nakliyat
Batıkent Boya Ustası
Çerkezköy Ekspertiz
Van Parça Eşya Taşıma
Samsun Evden Eve Nakliyat
Bayburt Evden Eve Nakliyat
Antep Şehir İçi Nakliyat
B6701
ReplyDeleteÇerkezköy Korkuluk
Çerkezköy Evden Eve Nakliyat
Etimesgut Parke Ustası
Afyon Parça Eşya Taşıma
Niğde Evden Eve Nakliyat
Yenimahalle Boya Ustası
Sakarya Lojistik
Bayburt Evden Eve Nakliyat
Çerkezköy Kombi Servisi
1BC97
ReplyDeleteEskişehir Evden Eve Nakliyat
Çerkezköy Parke Ustası
steroid cycles
Silivri Duşa Kabin Tamiri
Iğdır Evden Eve Nakliyat
Silivri Fayans Ustası
Adana Evden Eve Nakliyat
Kastamonu Evden Eve Nakliyat
testosterone propionat