Basic authorization in retrofit

Interface: @GET("burrowedbooks/") Call<JsonArray> getCategoryList(@Header("Authorization") String token); Usage: private LibraryAPi service; Retrofit retrofit = new Retrofit.Builder() //.client(client) .base...
more »

2017-10-21 15:10 (2) Answers

RxAndroid, Retrofit 2 unit test

I am newly learned the RxAndroid but unfortunately the book I studied did not covered any unit test. I have searched a lot on google but failed to find any simple tutorial that cover the RxAndroid unit test in precise way. I have basically wrote a s...
more »

2017-10-18 09:10 (1) Answers

Retrofit 2 cancel request working

I have been reading for a while about cancel request in retrofit 2.As far as i have read on cancel requests,onFailure() is called and request is removed from the queue if not dispatched. But what happens if the request is already been dispatched(i k...
more »

2017-10-11 10:10 (1) Answers

Android Retrofit 2 Custom JSON request

I am developing an application in i am using retrofit 2. My request JSON is as below { "FirstName":"ABC", "LastName":"XYZ", "Email":"", "Password":123456", "PhoneNo":"1234567890", "Country":"1", "State":"1", ...
more »

2017-09-15 13:09 (3) Answers

How can I debug my retrofit API call?

I'm using retrofit to get some data from the Flickr api. The method I'm making the call in looks like this: public static List<String> getImageIds(int size) { Call<PhotosList> call = flickrService.getPhotos(apiKey, format, "1"); ...
more »

2017-08-12 05:08 (2) Answers

Retrofit2: ExecutorCallAdapterFactory error

After calling API's using Retrofit 2.0, Unable to get any response and getting this error: Failure: retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall@5e38d31 I think this is internal retrofit error. Please help! ...
more »

2017-07-07 07:07 (1) Answers

android to REST : cannot serialize java Date

I have an android app that uses retrofit2 along with Jackson to serialize a set of classes, so as to send them to a mysql database via a REST api. All class fields are serialized fine, except from the ones with a type Date. Prior to the POST to the ...
more »

2017-07-02 02:07 (1) Answers

Get JSONObject from retrofit2 response

How to get in retrofit2 unknown JSON object from response object like this request (with OkHttp3): Observable<Response<MyResponseObject>> apiCall(@Body body); MyResponseObject look like this: public class MyResponseObject { @Se...
more »

2017-05-15 10:05 (2) Answers

Retrofit says auth token exists when logged out

When I log into my account in my app, I save an auth token in my SharedPreferences, like this: PreferenceUtils.setAuthToken(LoginActivity.this, authToken); Here is my PreferenceUtils class: public class PreferenceUtils { public static SharedP...
more »

2017-04-20 02:04 (2) Answers

Retrofit 2- how to get data from complicated JSON

I want to retrieve the data from list but i am not able too. I've tried like this: double t=response.body().getList().get(0).getTemp().getMax(); But I get a Null Pointer Exception Th...
more »

2017-04-19 03:04 (3) Answers

How to test Retrofit2 + RxJava2 api call?

I am wondering how to test Retrofit2 call via rxjava2. My retrofit api interface looks like: public interface LoginApiMapping { @POST("v1/secm/oam/oauth2/token") Observable<Response<RestResponseHolder<LoginResponseModel>>> l...
more »

2017-03-17 14:03 (2) Answers

Retrofit 2 parsing json , starting with array

Hope you are doing well . I found a problem which is really weird . I get the response via retrofit 2 and wanna pars it via gson . The Whole response is like this , [ {"id":1,"name":"x","family":"y"},{"id":2,"name":"a","family":"b"},... ] I hav...
more »

2017-03-12 13:03 (2) Answers

Retrofit2 Set-Cookie not present in response

My serve side is sending Set-Cookie on client response, but on Android Side i am not receiving anything related to Set-Cookie in header. My networking stack on android is Retrofit 2. Here my request code, HttpLoggingInterceptor interceptor = new Ht...
more »

2017-03-02 16:03 (1) Answers

Avoid retrofit POJO redundancy

I have a POJO class for retrofit. public class AppData(){ String a; String b; String c; String d; public void setA(String a){ this.a = a; } public String getA(){ return a; } ...
more »

2017-02-28 06:02 (2) Answers

Why Retrofit used with RxJava

I know the usage of Retrofit (Network fast library in Android) & Also RxJava(Filtering,handle heavy task etc..). But nowdays most of them use the Retrofit with RxJava. My Question: Retrofit Already in run on background thread. Then why need a...
more »

2017-02-14 05:02 (2) Answers