Response not updating from API | Android | Retrofit
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I am stuck in an issue-
There is a Login API - /user/login
AndI am getting the proper response in Postman -
{ "user": {
"um_id": "6446066c88d44fd787060bc6b662a84d",
"first_login": false,
"role": "APPLICANT",
"name": "riyo riyo",
"phone": "250231456987",
"applicant_id": "ea59ab45-760b-4f3d-99a8-f64da3c5a72a" // this is the field which updated at later stage from backend team.
}
}
But when I am calling the same API from Android App using retrofit then it is not giving the full response, its missing applicant_id param which was updated at later stage from backend team.
Response from mobile app using Retrofit -
{
"user": {
"um_id": "6446066c88d44fd787060bc6b662a84d",
"first_login": false,
"role": "APPLICANT",
"name": "riyo riyo",
"phone": "250231456987"
}}
You guys can see that the applicant_id is not coming when calling from Android App but it is coming if I am calling the same API from postman.
Here is my ApiClient.java class code -
public static Retrofit getClient() {
if (retrofit == null) {
OkHttpClient.Builder builder = new OkHttpClient.Builder();
builder.addInterceptor(new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request original = chain.request();
Request request;
request = original.newBuilder()
.build();
Response response = chain.proceed(request);
return response;
}
});
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
builder.addInterceptor(interceptor);
OkHttpClient okHttpClient = builder
.connectTimeout(5*60, TimeUnit.SECONDS)
.readTimeout(5*60, TimeUnit.SECONDS).
build();
retrofit = new Retrofit.Builder()
.baseUrl(ApiEndPoint.BASE_URL)
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
.client(okHttpClient)
.build();
}
return retrofit;
}
Here is my API calling code -
ApiHelper mApiHelper = ApiClient.getClient().create(ApiHelper.class);
LoginRequest mLoginRequest = new LoginRequest();
mLoginRequest.setClient(client);
mLoginRequest.setDevicetoken(deviceToken);
mLoginRequest.setEmail(email);
mLoginRequest.setPassword(password);
Gson gson = new GsonBuilder().create();
Logger.logsError(TAG, "JSON requestModal : " + gson.toJson(mLoginRequest));
mApiHelper.doLogin(mLoginRequest).enqueue(new Callback<JsonElement>() {
@Override
public void onResponse(Call<JsonElement> call, Response<JsonElement> response) {
Logger.logsError(TAG, "onResponse Called : " + response.toString() + " n call : " + call.request() + "n " +
response.body() + "n " + response.errorBody() + "n " + response.code());
if (response.code() == 200) {
getMvpView().hideLoading();
Logger.logsError(TAG, "response Header auth-token : " + response.headers().get("auth-token"));
Gson mGson1 = new Gson();
LoginResponse mLoginResponse = mGson1.fromJson(response.body().toString().trim(),
LoginResponse.class);
MyPreference.setUserData(mLoginResponse);
getMvpView().showMessage("login successful");
MyPreference.saveUserAuthToken(mLoginResponse.getToken().getAccessToken());
Logger.logsError(TAG,"response BODY : " + response.body().toString());
getMvpView().openHomeScreen();
} else if (response.code() == 401) {
getMvpView().showMessage(R.string.sessionExpireText);
getMvpView().openActivityOnTokenExpire();
} else {
getMvpView().onError(R.string.some_error);
}
}
@Override
public void onFailure(Call<JsonElement> call, Throwable t) {
Logger.logsError(TAG, "onFailure Called");
t.printStackTrace();
getMvpView().hideLoading();
getMvpView().onError(R.string.some_error);
}
});
LoginResponse.class
public class LoginResponse {
@SerializedName("token")
@Expose
private LoginTokenModal token;
@SerializedName("user")
@Expose
private LoginUserData user;
public LoginTokenModal getToken() {
return token;
}
public void setToken(LoginTokenModal token) {
this.token = token;
}
public LoginUserData getUser() {
return user;
}
public void setUser(LoginUserData user) {
this.user = user;
}
}
LoginUserData.class
public class LoginUserData {
@SerializedName("um_id")
@Expose
private String umId;
@SerializedName("first_login")
@Expose
private Boolean firstLogin;
@SerializedName("role")
@Expose
private String role;
@SerializedName("name")
@Expose
private String name;
@SerializedName("phone")
@Expose
private String phone;
@SerializedName("applicant_id")
@Expose
private String applicantId;
public String getUmId() {
return umId;
}
public void setUmId(String umId) {
this.umId = umId;
}
public Boolean getFirstLogin() {
return firstLogin;
}
public void setFirstLogin(Boolean firstLogin) {
this.firstLogin = firstLogin;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getApplicantId() {
return applicantId;
}
public void setApplicantId(String applicantId) {
this.applicantId = applicantId;
}
}
LoginTokenModal.class
public class LoginTokenModal {
@SerializedName("access_token")
@Expose
private String accessToken;
@SerializedName("token_type")
@Expose
private String tokenType;
@SerializedName("refresh_token")
@Expose
private String refreshToken;
@SerializedName("expires_in")
@Expose
private Integer expiresIn;
@SerializedName("scope")
@Expose
private String scope;
public String getAccessToken() {
return accessToken;
}
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
public String getTokenType() {
return tokenType;
}
public void setTokenType(String tokenType) {
this.tokenType = tokenType;
}
public String getRefreshToken() {
return refreshToken;
}
public void setRefreshToken(String refreshToken) {
this.refreshToken = refreshToken;
}
public Integer getExpiresIn() {
return expiresIn;
}
public void setExpiresIn(Integer expiresIn) {
this.expiresIn = expiresIn;
}
public String getScope() {
return scope;
}
public void setScope(String scope) {
this.scope = scope;
}
}
android caching retrofit postman
|
show 3 more comments
I am stuck in an issue-
There is a Login API - /user/login
AndI am getting the proper response in Postman -
{ "user": {
"um_id": "6446066c88d44fd787060bc6b662a84d",
"first_login": false,
"role": "APPLICANT",
"name": "riyo riyo",
"phone": "250231456987",
"applicant_id": "ea59ab45-760b-4f3d-99a8-f64da3c5a72a" // this is the field which updated at later stage from backend team.
}
}
But when I am calling the same API from Android App using retrofit then it is not giving the full response, its missing applicant_id param which was updated at later stage from backend team.
Response from mobile app using Retrofit -
{
"user": {
"um_id": "6446066c88d44fd787060bc6b662a84d",
"first_login": false,
"role": "APPLICANT",
"name": "riyo riyo",
"phone": "250231456987"
}}
You guys can see that the applicant_id is not coming when calling from Android App but it is coming if I am calling the same API from postman.
Here is my ApiClient.java class code -
public static Retrofit getClient() {
if (retrofit == null) {
OkHttpClient.Builder builder = new OkHttpClient.Builder();
builder.addInterceptor(new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request original = chain.request();
Request request;
request = original.newBuilder()
.build();
Response response = chain.proceed(request);
return response;
}
});
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
builder.addInterceptor(interceptor);
OkHttpClient okHttpClient = builder
.connectTimeout(5*60, TimeUnit.SECONDS)
.readTimeout(5*60, TimeUnit.SECONDS).
build();
retrofit = new Retrofit.Builder()
.baseUrl(ApiEndPoint.BASE_URL)
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
.client(okHttpClient)
.build();
}
return retrofit;
}
Here is my API calling code -
ApiHelper mApiHelper = ApiClient.getClient().create(ApiHelper.class);
LoginRequest mLoginRequest = new LoginRequest();
mLoginRequest.setClient(client);
mLoginRequest.setDevicetoken(deviceToken);
mLoginRequest.setEmail(email);
mLoginRequest.setPassword(password);
Gson gson = new GsonBuilder().create();
Logger.logsError(TAG, "JSON requestModal : " + gson.toJson(mLoginRequest));
mApiHelper.doLogin(mLoginRequest).enqueue(new Callback<JsonElement>() {
@Override
public void onResponse(Call<JsonElement> call, Response<JsonElement> response) {
Logger.logsError(TAG, "onResponse Called : " + response.toString() + " n call : " + call.request() + "n " +
response.body() + "n " + response.errorBody() + "n " + response.code());
if (response.code() == 200) {
getMvpView().hideLoading();
Logger.logsError(TAG, "response Header auth-token : " + response.headers().get("auth-token"));
Gson mGson1 = new Gson();
LoginResponse mLoginResponse = mGson1.fromJson(response.body().toString().trim(),
LoginResponse.class);
MyPreference.setUserData(mLoginResponse);
getMvpView().showMessage("login successful");
MyPreference.saveUserAuthToken(mLoginResponse.getToken().getAccessToken());
Logger.logsError(TAG,"response BODY : " + response.body().toString());
getMvpView().openHomeScreen();
} else if (response.code() == 401) {
getMvpView().showMessage(R.string.sessionExpireText);
getMvpView().openActivityOnTokenExpire();
} else {
getMvpView().onError(R.string.some_error);
}
}
@Override
public void onFailure(Call<JsonElement> call, Throwable t) {
Logger.logsError(TAG, "onFailure Called");
t.printStackTrace();
getMvpView().hideLoading();
getMvpView().onError(R.string.some_error);
}
});
LoginResponse.class
public class LoginResponse {
@SerializedName("token")
@Expose
private LoginTokenModal token;
@SerializedName("user")
@Expose
private LoginUserData user;
public LoginTokenModal getToken() {
return token;
}
public void setToken(LoginTokenModal token) {
this.token = token;
}
public LoginUserData getUser() {
return user;
}
public void setUser(LoginUserData user) {
this.user = user;
}
}
LoginUserData.class
public class LoginUserData {
@SerializedName("um_id")
@Expose
private String umId;
@SerializedName("first_login")
@Expose
private Boolean firstLogin;
@SerializedName("role")
@Expose
private String role;
@SerializedName("name")
@Expose
private String name;
@SerializedName("phone")
@Expose
private String phone;
@SerializedName("applicant_id")
@Expose
private String applicantId;
public String getUmId() {
return umId;
}
public void setUmId(String umId) {
this.umId = umId;
}
public Boolean getFirstLogin() {
return firstLogin;
}
public void setFirstLogin(Boolean firstLogin) {
this.firstLogin = firstLogin;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getApplicantId() {
return applicantId;
}
public void setApplicantId(String applicantId) {
this.applicantId = applicantId;
}
}
LoginTokenModal.class
public class LoginTokenModal {
@SerializedName("access_token")
@Expose
private String accessToken;
@SerializedName("token_type")
@Expose
private String tokenType;
@SerializedName("refresh_token")
@Expose
private String refreshToken;
@SerializedName("expires_in")
@Expose
private Integer expiresIn;
@SerializedName("scope")
@Expose
private String scope;
public String getAccessToken() {
return accessToken;
}
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
public String getTokenType() {
return tokenType;
}
public void setTokenType(String tokenType) {
this.tokenType = tokenType;
}
public String getRefreshToken() {
return refreshToken;
}
public void setRefreshToken(String refreshToken) {
this.refreshToken = refreshToken;
}
public Integer getExpiresIn() {
return expiresIn;
}
public void setExpiresIn(Integer expiresIn) {
this.expiresIn = expiresIn;
}
public String getScope() {
return scope;
}
public void setScope(String scope) {
this.scope = scope;
}
}
android caching retrofit postman
I don't know if it is useful or not but did you tried to use cellular network. Maybe Postman and device are in a same network and this causes this issue ?
– Murat Guc
Nov 22 '18 at 13:43
@MuratGuc I've tried that as well but its working in that case too.
– Shoeb Siddique
Nov 22 '18 at 13:46
can u post your LoginResponse class??
– Mohd Asif Ahmed
Nov 22 '18 at 14:06
@MohdAsifAhmed - Added required classes.
– Shoeb Siddique
Nov 22 '18 at 14:20
@ShoebSiddique can you try your first login with a different account over Android device. Maybe API refresh your * applicant_id* after some operations (like request counts, time etc.)
– Murat Guc
Nov 22 '18 at 14:30
|
show 3 more comments
I am stuck in an issue-
There is a Login API - /user/login
AndI am getting the proper response in Postman -
{ "user": {
"um_id": "6446066c88d44fd787060bc6b662a84d",
"first_login": false,
"role": "APPLICANT",
"name": "riyo riyo",
"phone": "250231456987",
"applicant_id": "ea59ab45-760b-4f3d-99a8-f64da3c5a72a" // this is the field which updated at later stage from backend team.
}
}
But when I am calling the same API from Android App using retrofit then it is not giving the full response, its missing applicant_id param which was updated at later stage from backend team.
Response from mobile app using Retrofit -
{
"user": {
"um_id": "6446066c88d44fd787060bc6b662a84d",
"first_login": false,
"role": "APPLICANT",
"name": "riyo riyo",
"phone": "250231456987"
}}
You guys can see that the applicant_id is not coming when calling from Android App but it is coming if I am calling the same API from postman.
Here is my ApiClient.java class code -
public static Retrofit getClient() {
if (retrofit == null) {
OkHttpClient.Builder builder = new OkHttpClient.Builder();
builder.addInterceptor(new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request original = chain.request();
Request request;
request = original.newBuilder()
.build();
Response response = chain.proceed(request);
return response;
}
});
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
builder.addInterceptor(interceptor);
OkHttpClient okHttpClient = builder
.connectTimeout(5*60, TimeUnit.SECONDS)
.readTimeout(5*60, TimeUnit.SECONDS).
build();
retrofit = new Retrofit.Builder()
.baseUrl(ApiEndPoint.BASE_URL)
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
.client(okHttpClient)
.build();
}
return retrofit;
}
Here is my API calling code -
ApiHelper mApiHelper = ApiClient.getClient().create(ApiHelper.class);
LoginRequest mLoginRequest = new LoginRequest();
mLoginRequest.setClient(client);
mLoginRequest.setDevicetoken(deviceToken);
mLoginRequest.setEmail(email);
mLoginRequest.setPassword(password);
Gson gson = new GsonBuilder().create();
Logger.logsError(TAG, "JSON requestModal : " + gson.toJson(mLoginRequest));
mApiHelper.doLogin(mLoginRequest).enqueue(new Callback<JsonElement>() {
@Override
public void onResponse(Call<JsonElement> call, Response<JsonElement> response) {
Logger.logsError(TAG, "onResponse Called : " + response.toString() + " n call : " + call.request() + "n " +
response.body() + "n " + response.errorBody() + "n " + response.code());
if (response.code() == 200) {
getMvpView().hideLoading();
Logger.logsError(TAG, "response Header auth-token : " + response.headers().get("auth-token"));
Gson mGson1 = new Gson();
LoginResponse mLoginResponse = mGson1.fromJson(response.body().toString().trim(),
LoginResponse.class);
MyPreference.setUserData(mLoginResponse);
getMvpView().showMessage("login successful");
MyPreference.saveUserAuthToken(mLoginResponse.getToken().getAccessToken());
Logger.logsError(TAG,"response BODY : " + response.body().toString());
getMvpView().openHomeScreen();
} else if (response.code() == 401) {
getMvpView().showMessage(R.string.sessionExpireText);
getMvpView().openActivityOnTokenExpire();
} else {
getMvpView().onError(R.string.some_error);
}
}
@Override
public void onFailure(Call<JsonElement> call, Throwable t) {
Logger.logsError(TAG, "onFailure Called");
t.printStackTrace();
getMvpView().hideLoading();
getMvpView().onError(R.string.some_error);
}
});
LoginResponse.class
public class LoginResponse {
@SerializedName("token")
@Expose
private LoginTokenModal token;
@SerializedName("user")
@Expose
private LoginUserData user;
public LoginTokenModal getToken() {
return token;
}
public void setToken(LoginTokenModal token) {
this.token = token;
}
public LoginUserData getUser() {
return user;
}
public void setUser(LoginUserData user) {
this.user = user;
}
}
LoginUserData.class
public class LoginUserData {
@SerializedName("um_id")
@Expose
private String umId;
@SerializedName("first_login")
@Expose
private Boolean firstLogin;
@SerializedName("role")
@Expose
private String role;
@SerializedName("name")
@Expose
private String name;
@SerializedName("phone")
@Expose
private String phone;
@SerializedName("applicant_id")
@Expose
private String applicantId;
public String getUmId() {
return umId;
}
public void setUmId(String umId) {
this.umId = umId;
}
public Boolean getFirstLogin() {
return firstLogin;
}
public void setFirstLogin(Boolean firstLogin) {
this.firstLogin = firstLogin;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getApplicantId() {
return applicantId;
}
public void setApplicantId(String applicantId) {
this.applicantId = applicantId;
}
}
LoginTokenModal.class
public class LoginTokenModal {
@SerializedName("access_token")
@Expose
private String accessToken;
@SerializedName("token_type")
@Expose
private String tokenType;
@SerializedName("refresh_token")
@Expose
private String refreshToken;
@SerializedName("expires_in")
@Expose
private Integer expiresIn;
@SerializedName("scope")
@Expose
private String scope;
public String getAccessToken() {
return accessToken;
}
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
public String getTokenType() {
return tokenType;
}
public void setTokenType(String tokenType) {
this.tokenType = tokenType;
}
public String getRefreshToken() {
return refreshToken;
}
public void setRefreshToken(String refreshToken) {
this.refreshToken = refreshToken;
}
public Integer getExpiresIn() {
return expiresIn;
}
public void setExpiresIn(Integer expiresIn) {
this.expiresIn = expiresIn;
}
public String getScope() {
return scope;
}
public void setScope(String scope) {
this.scope = scope;
}
}
android caching retrofit postman
I am stuck in an issue-
There is a Login API - /user/login
AndI am getting the proper response in Postman -
{ "user": {
"um_id": "6446066c88d44fd787060bc6b662a84d",
"first_login": false,
"role": "APPLICANT",
"name": "riyo riyo",
"phone": "250231456987",
"applicant_id": "ea59ab45-760b-4f3d-99a8-f64da3c5a72a" // this is the field which updated at later stage from backend team.
}
}
But when I am calling the same API from Android App using retrofit then it is not giving the full response, its missing applicant_id param which was updated at later stage from backend team.
Response from mobile app using Retrofit -
{
"user": {
"um_id": "6446066c88d44fd787060bc6b662a84d",
"first_login": false,
"role": "APPLICANT",
"name": "riyo riyo",
"phone": "250231456987"
}}
You guys can see that the applicant_id is not coming when calling from Android App but it is coming if I am calling the same API from postman.
Here is my ApiClient.java class code -
public static Retrofit getClient() {
if (retrofit == null) {
OkHttpClient.Builder builder = new OkHttpClient.Builder();
builder.addInterceptor(new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request original = chain.request();
Request request;
request = original.newBuilder()
.build();
Response response = chain.proceed(request);
return response;
}
});
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
builder.addInterceptor(interceptor);
OkHttpClient okHttpClient = builder
.connectTimeout(5*60, TimeUnit.SECONDS)
.readTimeout(5*60, TimeUnit.SECONDS).
build();
retrofit = new Retrofit.Builder()
.baseUrl(ApiEndPoint.BASE_URL)
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
.client(okHttpClient)
.build();
}
return retrofit;
}
Here is my API calling code -
ApiHelper mApiHelper = ApiClient.getClient().create(ApiHelper.class);
LoginRequest mLoginRequest = new LoginRequest();
mLoginRequest.setClient(client);
mLoginRequest.setDevicetoken(deviceToken);
mLoginRequest.setEmail(email);
mLoginRequest.setPassword(password);
Gson gson = new GsonBuilder().create();
Logger.logsError(TAG, "JSON requestModal : " + gson.toJson(mLoginRequest));
mApiHelper.doLogin(mLoginRequest).enqueue(new Callback<JsonElement>() {
@Override
public void onResponse(Call<JsonElement> call, Response<JsonElement> response) {
Logger.logsError(TAG, "onResponse Called : " + response.toString() + " n call : " + call.request() + "n " +
response.body() + "n " + response.errorBody() + "n " + response.code());
if (response.code() == 200) {
getMvpView().hideLoading();
Logger.logsError(TAG, "response Header auth-token : " + response.headers().get("auth-token"));
Gson mGson1 = new Gson();
LoginResponse mLoginResponse = mGson1.fromJson(response.body().toString().trim(),
LoginResponse.class);
MyPreference.setUserData(mLoginResponse);
getMvpView().showMessage("login successful");
MyPreference.saveUserAuthToken(mLoginResponse.getToken().getAccessToken());
Logger.logsError(TAG,"response BODY : " + response.body().toString());
getMvpView().openHomeScreen();
} else if (response.code() == 401) {
getMvpView().showMessage(R.string.sessionExpireText);
getMvpView().openActivityOnTokenExpire();
} else {
getMvpView().onError(R.string.some_error);
}
}
@Override
public void onFailure(Call<JsonElement> call, Throwable t) {
Logger.logsError(TAG, "onFailure Called");
t.printStackTrace();
getMvpView().hideLoading();
getMvpView().onError(R.string.some_error);
}
});
LoginResponse.class
public class LoginResponse {
@SerializedName("token")
@Expose
private LoginTokenModal token;
@SerializedName("user")
@Expose
private LoginUserData user;
public LoginTokenModal getToken() {
return token;
}
public void setToken(LoginTokenModal token) {
this.token = token;
}
public LoginUserData getUser() {
return user;
}
public void setUser(LoginUserData user) {
this.user = user;
}
}
LoginUserData.class
public class LoginUserData {
@SerializedName("um_id")
@Expose
private String umId;
@SerializedName("first_login")
@Expose
private Boolean firstLogin;
@SerializedName("role")
@Expose
private String role;
@SerializedName("name")
@Expose
private String name;
@SerializedName("phone")
@Expose
private String phone;
@SerializedName("applicant_id")
@Expose
private String applicantId;
public String getUmId() {
return umId;
}
public void setUmId(String umId) {
this.umId = umId;
}
public Boolean getFirstLogin() {
return firstLogin;
}
public void setFirstLogin(Boolean firstLogin) {
this.firstLogin = firstLogin;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getApplicantId() {
return applicantId;
}
public void setApplicantId(String applicantId) {
this.applicantId = applicantId;
}
}
LoginTokenModal.class
public class LoginTokenModal {
@SerializedName("access_token")
@Expose
private String accessToken;
@SerializedName("token_type")
@Expose
private String tokenType;
@SerializedName("refresh_token")
@Expose
private String refreshToken;
@SerializedName("expires_in")
@Expose
private Integer expiresIn;
@SerializedName("scope")
@Expose
private String scope;
public String getAccessToken() {
return accessToken;
}
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
public String getTokenType() {
return tokenType;
}
public void setTokenType(String tokenType) {
this.tokenType = tokenType;
}
public String getRefreshToken() {
return refreshToken;
}
public void setRefreshToken(String refreshToken) {
this.refreshToken = refreshToken;
}
public Integer getExpiresIn() {
return expiresIn;
}
public void setExpiresIn(Integer expiresIn) {
this.expiresIn = expiresIn;
}
public String getScope() {
return scope;
}
public void setScope(String scope) {
this.scope = scope;
}
}
android caching retrofit postman
android caching retrofit postman
edited Nov 22 '18 at 14:20
Shoeb Siddique
asked Nov 22 '18 at 13:39
Shoeb SiddiqueShoeb Siddique
2,14911032
2,14911032
I don't know if it is useful or not but did you tried to use cellular network. Maybe Postman and device are in a same network and this causes this issue ?
– Murat Guc
Nov 22 '18 at 13:43
@MuratGuc I've tried that as well but its working in that case too.
– Shoeb Siddique
Nov 22 '18 at 13:46
can u post your LoginResponse class??
– Mohd Asif Ahmed
Nov 22 '18 at 14:06
@MohdAsifAhmed - Added required classes.
– Shoeb Siddique
Nov 22 '18 at 14:20
@ShoebSiddique can you try your first login with a different account over Android device. Maybe API refresh your * applicant_id* after some operations (like request counts, time etc.)
– Murat Guc
Nov 22 '18 at 14:30
|
show 3 more comments
I don't know if it is useful or not but did you tried to use cellular network. Maybe Postman and device are in a same network and this causes this issue ?
– Murat Guc
Nov 22 '18 at 13:43
@MuratGuc I've tried that as well but its working in that case too.
– Shoeb Siddique
Nov 22 '18 at 13:46
can u post your LoginResponse class??
– Mohd Asif Ahmed
Nov 22 '18 at 14:06
@MohdAsifAhmed - Added required classes.
– Shoeb Siddique
Nov 22 '18 at 14:20
@ShoebSiddique can you try your first login with a different account over Android device. Maybe API refresh your * applicant_id* after some operations (like request counts, time etc.)
– Murat Guc
Nov 22 '18 at 14:30
I don't know if it is useful or not but did you tried to use cellular network. Maybe Postman and device are in a same network and this causes this issue ?
– Murat Guc
Nov 22 '18 at 13:43
I don't know if it is useful or not but did you tried to use cellular network. Maybe Postman and device are in a same network and this causes this issue ?
– Murat Guc
Nov 22 '18 at 13:43
@MuratGuc I've tried that as well but its working in that case too.
– Shoeb Siddique
Nov 22 '18 at 13:46
@MuratGuc I've tried that as well but its working in that case too.
– Shoeb Siddique
Nov 22 '18 at 13:46
can u post your LoginResponse class??
– Mohd Asif Ahmed
Nov 22 '18 at 14:06
can u post your LoginResponse class??
– Mohd Asif Ahmed
Nov 22 '18 at 14:06
@MohdAsifAhmed - Added required classes.
– Shoeb Siddique
Nov 22 '18 at 14:20
@MohdAsifAhmed - Added required classes.
– Shoeb Siddique
Nov 22 '18 at 14:20
@ShoebSiddique can you try your first login with a different account over Android device. Maybe API refresh your * applicant_id* after some operations (like request counts, time etc.)
– Murat Guc
Nov 22 '18 at 14:30
@ShoebSiddique can you try your first login with a different account over Android device. Maybe API refresh your * applicant_id* after some operations (like request counts, time etc.)
– Murat Guc
Nov 22 '18 at 14:30
|
show 3 more comments
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53432269%2fresponse-not-updating-from-api-android-retrofit%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53432269%2fresponse-not-updating-from-api-android-retrofit%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I don't know if it is useful or not but did you tried to use cellular network. Maybe Postman and device are in a same network and this causes this issue ?
– Murat Guc
Nov 22 '18 at 13:43
@MuratGuc I've tried that as well but its working in that case too.
– Shoeb Siddique
Nov 22 '18 at 13:46
can u post your LoginResponse class??
– Mohd Asif Ahmed
Nov 22 '18 at 14:06
@MohdAsifAhmed - Added required classes.
– Shoeb Siddique
Nov 22 '18 at 14:20
@ShoebSiddique can you try your first login with a different account over Android device. Maybe API refresh your * applicant_id* after some operations (like request counts, time etc.)
– Murat Guc
Nov 22 '18 at 14:30