Google Volley vs Android-Async-Http
Asked Answered
S

3

13

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?

Substitution answered 17/8, 2014 at 6:30 Comment(4)
biggest difference is Volley created by Google , Owner of Android!Coenurus
you can use OkHttp by volley. just configure its HttpStack to use OkHttp!! volley can also download images, look at the googleIO2013 video that introduce volley to see its features and then decide!! because i have not used loopj and also do not know your exact requirements i do not answer to your questionBelldas
You may not find any complete documentation of Volley, but Google has recently included a good training section in the DAC: developer.android.com/training/volley/index.html It should be useful for the basic usage. And, it probably indicates that Google is working on it's documentation, too!Eyesore
And, this discussion looks relevant : #16903216Eyesore
W
6

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.

Wraparound answered 16/7, 2015 at 12:15 Comment(0)
L
1

We are currently using a combination of Volley and GSON in our application. There is nothing we haven't been able to do, and we use just about every type of HTTP request you can imagine. This currently includes:

  • Normal HTTP requests with JSON response
  • POST requests with form encoded data as well as raw byte arrays
  • Multipart HTTP requests with large objects such as images and files
  • Custom request headers
  • Internationalized requests

We have yet to run into a roadblock we could not overcome, though we had to write a fair amount of code to support all these features and build the framework we wanted, but that should be expected with any HTTP library.

Also Volley comes with an ImageLoader which handles caching of images, as well as a bunch of other nifty features.

Lima answered 26/3, 2015 at 19:58 Comment(3)
Does the support issue not concern you? Google seemed to release volley and have not really maintained or put much effort into the project?Substitution
I'm not sure I totally agree with that statement. If you have a look at the Volley repository here: android.googlesource.com/platform/frameworks/volley You'll see that Google is continuing to make updates, as recently as 8 days ago. Additionally, they always release a new tag each time they update the Android OS.Lima
The best combination with Volley to me nowadays is OkHttp + Volley + Gson. Take a look at this -> goo.gl/nl2DfNWraparound
B
1

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.

Byerly answered 7/2, 2016 at 16:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.