
Which Android HTTP library to use - chetanahuja
https://packetzoom.com/blog/which-android-http-library-to-use.html
======
aavegmittal
Very nice compilation. How does these different libraries behave in terms of
network performance? My use case is to download many small thumbnails and as
the user scrolls up the view, I'd want to cancel the transfer for the images
that has been out of view.

~~~
bexp
I would recommend Fresco from Facebook, they had implemented cancellation
logic also memory allocation done in more efficient way than other libs.

~~~
aavegmittal
Cool, thanks. Now, how are they handling "cancellation" of requests on the
network (which have already been made). As far as I understand, HTTP/TCP has
no option to cancel a transfer, without closing the connection itself (which
would have other implications). So, once a request is made to the server, is
there any option to Fresco to tell the server to stop it in some way?

~~~
bexp
Facebook using java.util.concurrent.Future<T> interface for downloading task:
see here

[https://github.com/facebook/fresco/blob/c5e1d4cf2c081bf871f5...](https://github.com/facebook/fresco/blob/c5e1d4cf2c081bf871f59f70cd02e4a68950ac41/imagepipeline/src/main/java/com/facebook/imagepipeline/producers/HttpUrlConnectionNetworkFetcher.java)

you can ether call future.cancel() or cancel(true): in first case download
task will be finished but further processing in pipeline will be stopped.
Future.cancel(true) is more aggressive and abandons download but you will get
InterruptedException. As you see from source code Facebook using less
aggressive approach with future.cancel(false) call.

------
chetanahuja
The life of the Android dev is complicated. The number and variety of
libraries available as http clients is getting bafflingly large. This post
tries to put some organization around the ecosystem. Extremely useful read if
you're trying to make sense of the whole mess for the first time.

~~~
rp248
Thanks for posting. Coming to Android from iOS.. I really could not make sense
of which library to pick by myself as opposed to a very few obvious choices in
iOS. Appreciate this very much.

------
bexp
Nice writeup, would love to see more performance tests

------
sunand
nice post on which Http lib to use. Any suggestions on which of them to use
for dealing with sockets with persistent connection ?

------
DrBoyfriend
Thanks for the detailed breakdown. This is very helpful.

------
patkennard
Which library uses Quic?

~~~
chetanahuja
Heh... well this compilation is all about HTTP libraries specifically. Who
knows what google has in mind for QUIC for native apps.

