Google Volley vs Android-Async-Http

I am browsing both of these Android Http Networking libraries.

I would like some people to survive using two libraries. Personally, I always used the http://loopj.com/android-async-http/ library quite happily. But I was recently offered to use the Volleyball platform.

What benefits will I get from one another? From my reading so far, Volley includes a number of nice features, such as Image loading, Caching requests, Request Cancel all in one library.

My current use case / feature:

Use web services from Android apps.

  • Get JSON objects from web service
  • Easy GUI Integration
  • Stability and reliability over wet performance
  • Long-term maintenance and library support.
  • Ease of use / ease of implementation

From some readings on SE:

β€œVolleyball is good, but, on the minus side, this is one undocumented, unsupported,” drop the code through the wall and make a presentation i | O on it. "

So, I think that his pure volleyball can get a tick for the function, but how well documented and maintained? If I decide to use it, will it still support it 4 years below the line?

+6
source share
3 answers

Volleyball and Android Async Http are two different things.

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

  • Volley It is a REST helper / library that helps you handle asynchronous requests and image loading. Volley is not an http client. Volleyball uses the SDK http clients (apache or httpclient depending on the API level) if you do not provide it, but the general client for volley is OkHttp ( https://goo.gl/nl2DfN ). You can also easily integrate Volley with Gson.

From my point of view, you give as much responsibility to one library, the less settings you have and the more unnecessary code that you add. That reason libraries like Android Async Http or ION are losing control now, and other features like Square solutions (Okio + OkHttp + Retrofit + Moshi + Picasso - those five libraries) are gaining ground. So, here you have 5 libraries that can be used separately as stand-alone or connected to each other as 2, 3 or 4. This is flexibility and power.

For further reading of this, take a look at this answer.

+3
source

We are currently using a combination of Volley and GSON in our application. We can't do anything, and we use almost every HTTP request you can imagine. This currently includes:

  • Regular HTTP requests with a JSON response
  • POST requests with encoded data forms, as well as arrays of source bytes
  • Multi-page HTTP requests with large objects such as images and files
  • Custom Request Headers
  • Internationalized Queries

We still have to face an obstacle that we could not overcome, although we had to write quite a lot of code to support all these functions and create the infrastructure we needed, but this was to be expected with any HTTP library.

Volley also comes with ImageLoader, which handles image caching, as well as many other great features.

+1
source

Difference between Android Volley and AsyncTask

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

Using AsyncTask was a good approach, but consider Android Volley as version 2.0. It has many improvements over AsyncTask since the volley is designed to access the network. The main advantage of Android Volley over AsyncTask is that you can execute multiple requests at the same time without the overhead of managing threads. I also think that the replay mechanism is a great feature of volleyball, which gives it an edge over AsynTask. Another advantage of volleyball over AsyncTask is that it provides you with several types of requests, thanks to which complex requests can be made easily. On the other hand, when using AsyncTasks you will need to create this type of query manually.

Although the best approach is different from application to application. For example, if you have fewer requests, you can use AsyncTask. As for volleyball, you need to import a library project that increases the size of your project. Therefore, it is wise to choose between a salvo and AsyncTask. Hope this Android Volley vs AsyncTask selection helps you choose.

0
source

Source: https://habr.com/ru/post/973918/


All Articles