I'm looking for a good HTTP library for my android app. I've been using AsyncHTTP by loopj (and I've only ever used that), but it's making my app crash when the network connection is lost. Also, it doesn't meet my requirements well. So far, I've found okhttp by Square and volley by Google. But I'm not sure which suits my purposes better. The following would be my requirements,
- Small frequent http request for JSON results
- JSON parsing
- Async operation with callback methods
- Caching, with functionality for force re-fetch
Some insights into how these differ and what I should be using, would be immensely helpful.
OkHttpis an HttpClient. If you want JSON parsing and callback methods you should useRetrofitwhich usesOkHttpinternally. Both Retrofit and Volley are suitable for your requirements.Volleyalso has an image downloader in it but if you want image downloading when usingOkHttpyou need to usePicassofrom square (which I suggest).I personally suggest using
Retrofit+Picasso. They are lightweight and perform really well and they have a decent documentation.