Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Volley vs Android-Async-Http

I am looking into both these Android Http Networking libraries.

I would like some peoples experiences with using the two libraries. Personally I have always used the http://loopj.com/android-async-http/ library quite happily. But it was recently suggested to me to use the Volley Framework.

What benefits will I get from one over the other?
From my reading so far, Volley incorporates a number of nice features such as Image Loading, Request Caching, Request Cancelling all in one library.

My current use case / specifications:

Consume web services from my android applications.

  • Receive JSON Objects from web service
  • Easy To integrate with the GUI
  • Stability and Reliability over raw performance
  • Long term maintenance and support of the library.
  • Ease of use / ease of implementation

From some reading up on SE:

"Volley is all good but, On the minus side, it is one undocumented, unsupported, "throw the code over the wall and do an I|O presentation on it" library."

So I think its clear Volley might get the tick for features, But how well documented and maintained is it? If I decide to use it will there still be support for it 4 years down the line?

like image 247
Zapnologica Avatar asked Aug 17 '14 06:08

Zapnologica


2 Answers

Difference between Android Volley and AsyncTask

Try this link http://www.truiton.com/2015/02/android-volley-vs-asynctask-better-approach/

Using AsyncTask has been a good approach, but consider Android Volley as a 2.0 version of it. It has many improvements over AsyncTask, as volley is designed for the purpose of network access. A major advantage of Android Volley over AsyncTask is that you can do multiple requests simultaneously without the overhead of thread management. Also I believe retry mechanism is a great feature of volley which gives it an edge over AsynTask. Another advantage of volley over AsyncTask is that it provides you with multiple request types, through which complex requests can be made easily. On the other hand while using AsyncTasks one would have to create this type of request manually.

Although best approach differs from application to application. Like if you have less no of requests to make, you can use AsyncTask. As for volley, one has to import a library project which increases your project size. Hence pick wisely between volley and AsyncTask. Hope this Android Volley vs AsyncTask sum up helped you choose.

like image 122
chank007 Avatar answered Nov 14 '22 02:11

chank007


Volley and Android Async Http are different things.

  • Android Async Http: Is a powerful Http client. Offers some functionalities as REST helper and integration for JSON parsing with other libraries.

  • Volley: Is a REST helper/library that helps you to deal with async requests and image loading. Volley it's not an http client. Volley uses the SDK http clients (the apache or the httpclient depending on the API level) if you don't provide one, but a common client for volley is OkHttp (https://goo.gl/nl2DfN). You can integrate Volley with Gson easily as well.

From my point of view, as much responsibility you give to a single library, less customization you have and more unneeded code you'll add. That's the reason libraries as Android Async Http or ION are losing grip nowadays and other options like the Square solutions (Okio + OkHttp + Retrofit + Moshi + Picasso - Those are five libraries) are gaining grip. So here you have 5 libraries that can be used separately as standalone or tied together as 2, 3 or 4. That's flexibility and power.

For further reading on this take a look at this answer.

like image 37
Sotti Avatar answered Nov 14 '22 00:11

Sotti