Fast-android-networking: Differences with Retrofit?

Created on 3 Jun 2016  路  9Comments  路  Source: amitshekhariitbhu/Fast-Android-Networking

Maybe you should explain what are the differences between this library and Retrofit.

Most helpful comment

@bryant1410 surely I will add that.

All 9 comments

@bryant1410 Thanks for pointing out this.
I have updated the Readme.md file.

  • OkHttpClient can be customized for every request easily.
  • Complete analytics of any request can be obtained.
  • Getting current bandwidth and connection quality can be obtained to decide logic of code.
  • Executor can be passed to any request to get response in another thread.
  • Single library for all type of networking.
  • Prefetching of any request can be done so that it gives instant data when required from cache.
  • All types of customization is possible

And do you have any performance comparison with Retrofit?

@bryant1410 : performance is same as both uses OkHttp but Android Networking gives some extra features.

You can give a performance test to probe that. And to pretend that people use your library.

@bryant1410 surely I will add that.

If you can create performance test comparing this library with Volley or Retrofit, it will be better i think. This library is looks promising with a lot of features in a single library, but of course as a developer we need to make our application is good in performance too. So we need to make sure the performance of each library we used.

  • and very easy to using and fast, very comfortable to developers!. Thank you @amitshekhariitbhu for great library, need recommend this is for Google, need add this library to android such as default http library. And need add some functionalities to this library such as : adding dependency executing http request and communication its, and managing response results with hierarchy. For example send request1 with request2 in parallel and if results both ok then do execute request4 otherwise call to callback. This is great functions and exists in SWIFT(for ios developers).

@boyfox we will add the feature of merging two requests in the upcoming release.

My Code for simple get method is not working it is give me error
url="http://dev.efurtherance.com/rcis_school_new/webservice/system/all"
param=school_code
AndroidNetworking.get("http://dev.efurtherance.com/rcis_school_new/webservice/system/all")
.addQueryParameter("school_code", "RCISTHANE")
.setTag("test")
.setPriority(Priority.LOW)
.build()
.getAsJSONArray(new JSONArrayRequestListener() {
@Override
public void onResponse(JSONArray response) {
// do anything with response
Log.e("resp", String.valueOf(response));

                }
                @Override
                public void onError(ANError error) {
                    // handle error
                    Log.e("resp", String.valueOf("error"));

                }
            });

/////////////////////////////////////////////////

And code for upload image file also not working it gives me connection error
url="http://dev.efurtherance.com/rcis_school_new/webservice/teacher/update"
params=profile_image(image file),action,reference;
AndroidNetworking.upload("http://dev.efurtherance.com/rcis_school_new/webservice/teacher/update")
.addMultipartFile("profile_image", new File(imgpath))
.addMultipartParameter("action", "updateprofileimage")
.addMultipartParameter("reference","T1038")
.setPriority(Priority.HIGH)
.build()
.setUploadProgressListener(new UploadProgressListener() {
@Override
public void onProgress(long bytesUploaded, long totalBytes) {
// do anything with progress
}
})
.getAsJSONObject(new JSONObjectRequestListener() {
@Override
public void onResponse(JSONObject response) {
// do anything with response
Log.e("resp", String.valueOf(response));
}

                @Override
                public void onError(ANError error) {
                    // handle error
                    Log.e("resp", String.valueOf("error"));
                    if (error.getErrorCode() != 0) {
                        // received error from server
                        // error.getErrorCode() - the error code from server
                        // error.getErrorBody() - the error body from server
                        // error.getErrorDetail() - just an error detail
                        Log.e("onError errorCode : ", String.valueOf(error.getErrorCode()));
                        Log.e("onError errorBody : ", String.valueOf(error.getErrorBody()));
                        Log.e("onError errorDetail : ", String.valueOf(error.getErrorDetail()));
                        // get parsed error object (If ApiError is your class)
                    } else {
                        // error.getErrorDetail() : connectionError, parseError, requestCancelledError
                        Log.e("onError errorDetail : ", String.valueOf(error.getErrorDetail()));
                    }
                }
            });
Was this page helpful?
0 / 5 - 0 ratings

Related issues

everyline picture everyline  路  9Comments

Patrick-Wallin picture Patrick-Wallin  路  8Comments

amervelic picture amervelic  路  3Comments

stridercheng picture stridercheng  路  6Comments

GulajavaMinistudio picture GulajavaMinistudio  路  3Comments