Monday, August 17, 2015

Background tasks : RoboSpice vs Volley – my choice of choosing RoboSpice


Robospice is an open source library that eases writing async network requests. It executes requests inside an android service. It is service based and more respectful of Android philosophy than Volley. Volley is thread based and this is not the way background processing should take place on Android. Ultimately, we can dig down both libs and find that they are quite similar, but our way to do background processing is more Android oriented, it allow us, for instance, to tell users that Robospice is actually doing something in background, which would be hard for volley ( actually it doesn't at all ).
RoboSpice and volley both offer nice features like prioritization, retry policies, request cancellation. But Robospice offers more : a more advanced caching, with cache management, request aggregation, more features like repluging to a pending request, dealing with cache expiry without relying on server headers, etc.
RoboSpice does more outside of UI Thread : volley will deserialize the POJOs on the main thread, which is horrible to my mind. With Robospice your app will be more responsive.
In terms of speed, we definitely need metrics. Robospice has gotten super fast now, but still we don't have figure to put here. Volley should theoretically be a bit faster, but Robospice  is now massively parallel.
RoboSpice offers a large compatibility range with extensions. You can use it with okhttp, retrofit, ormlite , jackson, jackson2, gson, xml serializer, google http client, spring android... Quite a lot. Volley can be only used with ok http and uses gson.
Volley offers more UI sugar. Volley provides NetworkImageView, Robospice does provide a spicelist adapter. In terms of feature it's not so far, but I believe Volley is more advanced on this topic.
More than 200 bugs have been solved in RoboSpice since its initial release. It's pretty robust and used heavily in production. Volley is less mature but its user base should be growing fast (of course because it’s a google product).

Volley roughly competes with Retrofit + RoboSpice. On the plus side, it is one library. On the minus side, it is one undocumented, unsupported.
Go for RS anytime, All others are a joke ;)
References :
  • http://wiki.neerad.com/wiki/Android/Using_Robospice_with_Retrofit
  • https://github.com/stephanenicolas/robospice/wiki/Retrofit-module
  • https://groups.google.com/forum/#!topic/robospice/QwVCfY_glOQ