Comparison of Android Networking Libraries: Okhttp, Retrofit, and Volley

Comparison of Android networking libraries: OkHTTP, Retrofit, and Volley

I'm hoping someone can provide some concrete examples of best use cases for each.

Use Retrofit if you are communicating with a Web service. Use the peer library Picasso if you are downloading images. Use OkHTTP if you need to do HTTP operations that lie outside of Retrofit/Picasso.

Volley roughly competes with Retrofit + Picasso. On the plus side, it is one library. On the minus side, it is one undocumented, an unsupported, "throw the code over the wall and do an I|O presentation on it" library.

EDIT - Volley is now officially supported by Google. Kindly refer Google Developer Guide

From what I've read, seems like OkHTTP is the most robust of the 3

Retrofit uses OkHTTP automatically if available. There is a Gist from Jake Wharton that connects Volley to OkHTTP.

and could handle the requirements of this project (mentioned above).

Probably you will use none of them for "streaming download of audio and video", by the conventional definition of "streaming". Instead, Android's media framework will handle those HTTP requests for you.

That being said, if you are going to attempt to do your own HTTP-based streaming, OkHTTP should handle that scenario; I don't recall how well Volley would handle that scenario. Neither Retrofit nor Picasso are designed for that.

Android networking library: Is it still worth using Volley?

Check out the detailed response:
Comparison of Android networking libraries: OkHTTP, Retrofit, and Volley

Personally, I went native to keep things simple and robust. Using it for JSON responses and occasional images with no problem and I don't think they will deprecate HttpURLConnection anytime soon.

Http Libraries Comparison fro Android. Which is Preferred?

There are tow library mostly used for perform network Related operations, which are followings,

1. Volley

2. Retrofit

Volley Android Networking Library

$ git clone https://android.googlesource.com/platform/frameworks/volley
$ cd volley
$ android update project -p .
$ ant jar

Then, copy bin/volley.jar into your libs/ folder and off you go!

source

Volley+ OkHttpClient why use both?

(from volley google i/o video):

In nutshell:

Volley is:

  • Great for rpc-tyle network operations that populate UI.
  • Fine for background RPCs.
  • Terrible for large payloads.

In Volley everything happens in the memory so that isn't great for large data downloading (such as a big image or streaming contents).

Take a look at this question



Related Topics



Leave a reply



Submit