Coder Social home page Coder Social logo

hsccorp / testhttplibs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aggarwal-ankur/testhttplibs

0.0 3.0 0.0 217 KB

This is a sample project used to compare different HTTP libraries available on Android

License: Other

Java 99.73% Makefile 0.27%

testhttplibs's Introduction

A demo project to test various Http libs available in Android. Libraries demo'ed in this are : HttpURLConnection, OK HTTP, Retrofit, Volley.

The demo has been organised so that each component is readily usable.

To view code for HttpURLConnection, go to the folder : app/src/main/java/com/aggarwalankur/testhttplibs/httpurlconxn

To view code for OK HTTP, go to the folder : app/src/main/java/com/aggarwalankur/testhttplibs/okhttp

To view code for Retrofit, go to the folder : app/src/main/java/com/aggarwalankur/testhttplibs/retrofit

To view code for Volley, go to the folder : app/src/main/java/com/aggarwalankur/testhttplibs/volley


Volley has been added as a github project, so you may use the command : 'git clone https://android.googlesource.com/platform/frameworks/volley'

to clone the project and then import it as a dependency project


To use this demo, you need an API key (by signing up here : https://www.themoviedb.org/documentation/api ). This API key is not required for Volley, Retrofit, OK HTTP or HttpURLConnection, but is required for the HTTP requests which are used to demonstrate the code and image loading capabilities in this demo.

Once you have the API key, place your API key in the following file : %USERHOME%.gradle\gradle.properties

The above gradle.properties should include a line like this : MyMovieDbApiKey = "your-api-key"


For the setup information and additional resources of each library, refer to :

HttpURLConnection: https://developer.android.com/reference/java/net/HttpURLConnection.html

OK HTTP: http://square.github.io/okhttp/ https://http2.github.io/faq/

Retrofit: http://square.github.io/retrofit/ https://futurestud.io/blog/retrofit-2-how-to-add-query-parameters-to-every-request https://speakerdeck.com/jakewharton/simple-http-with-retrofit-2-droidcon-nyc-2015

Volley: http://www.technoburgh.com/android/android-studio-volley/ https://developer.android.com/training/volley/request.html https://www.bignerdranch.com/blog/solving-the-android-image-loading-problem-volley-vs-picasso/


Most of the code for the libraries used in this is available under Apache Software License 2.0 (See respective licenses and LICENSE.md)


                           Volley                          Retrofit                     OK Http                       HttpUrlConnection
First setup                AOSP (Github checkout)          Maven (jar available)        Maven (jar available)         None
First setup time           30 min (documentation !)        2 min                        2 min                         None
APK Size (Base)            1318 KB                         1463 KB                      1423 KB                       1108 KB
Request Queue              Possible                        Possible but custom          No                            No
Request Prioritization     Possible but looks crappy       No                           No                            No
Thread Pool                Default = 4                     Default = unlimited          No                            No
Caching                    Default + Custom                custom                       Custom                        Not working for me
Cache Type                 RAM + Disk based                RAM + Disk based             RAM                           NA
Cancellation               Possible                        Only marks as cancelled      Only marks as cancelled       Only marks as cancelled
Image loading              Easy                            No (With Picasso)            No                            No
Batch response             Possible                        No                           No                            No
Cache Sizes                Customizable                    Customizable                 Customizable                  Not working for me
Retry Policy               Customizable                    Customizable                 Customizable                  No
Responses                  Default = Raw                   Parsed                       Raw                           Raw
URL Manipulation           No                              Yes                          No                            No

    
    

testhttplibs's People

Contributors

aggarwal-ankur avatar aggarwal-ankur-238 avatar

Watchers

James Cloos avatar Arjun Roychowdhury avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.