I have a simple network call that uses Jackson for converter with settings as below
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("*****")
.addConverterFactory(JacksonConverterFactory.create(new
ObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL)))
.build();
apiService = retrofit.create(APIService.class);
and
getting a list of BGControl object using
public interface APIService {
@GET("endpoint/{ID}")
Call<List<BGControl>> getBGControlData(@Path("ID") int patientId, @Query("start") String startDate, @Query("end") String endDate);
}
and below is BGControl class,
@JsonIgnoreProperties(ignoreUnknown = true)
public class BGControl {
String Activity;
String Glucose_mg_dL;
String Glucose_mmol_L;
String Timestamp;
String Classification;
String ReadingType;
int intervals = 0;
public BGControl() {
}
public BGControl(String activity, String glucose_mg_dL, String glucose_mmol_L, String timestamp, String classification, String readingType) {
Activity = activity;
Glucose_mg_dL = glucose_mg_dL;
Glucose_mmol_L = glucose_mmol_L;
Timestamp = timestamp;
Classification = classification;
ReadingType = readingType;
}
public void setActivity(String activity) {
Activity = activity;
}
public void setGlucose_mg_dL(String glucose_mg_dL) {
Glucose_mg_dL = glucose_mg_dL;
}
public void setGlucose_mmol_L(String glucose_mmol_L) {
Glucose_mmol_L = glucose_mmol_L;
}
public void setTimestamp(String timestamp) {
Timestamp = timestamp;
}
public void setClassification(String classification) {
Classification = classification;
}
public void setReadingType(String readingType) {
ReadingType = readingType;
}
public String getActivity() {
return Activity;
}
public String getGlucose_mg_dL() {
return Glucose_mg_dL;
}
public String getGlucose_mmol_L() {
return Glucose_mmol_L;
}
public String getTimestamp() {
return Timestamp;
}
public String getClassification() {
return Classification;
}
public String getReadingType() {
return ReadingType;
}
public int getIntervals() {
return intervals;
}
public void setIntervals(int intervals) {
this.intervals = intervals;
}
@Override
public String toString() {
return "BGControl{" +
"Activity='" + Activity + '\'' +
", Glucose_mg_dL='" + Glucose_mg_dL + '\'' +
", Glucose_mmol_L='" + Glucose_mmol_L + '\'' +
", Timestamp='" + Timestamp + '\'' +
", Classification='" + Classification + '\'' +
", ReadingType='" + ReadingType + '\'' +
'}';
}
}
below is the network call consumer code
final Call<List<BGControl>> graphDataCall = NetworkManager.getInstance().getAPIService().getBGControlData(13614, startDate, endDate);
graphDataCall.enqueue(new Callback<List<BGControl>>() {
@Override
public void onResponse(Call<List<BGControl>> call, Response<List<BGControl>> response) {
List<BGControl> bgControlList = response.body();
if (bgControlList.size() > 0) {
}
}
@Override
public void onFailure(Call<List<BGControl>> call, Throwable t)
{
graphDataCall.cancel();
}
});
However, the problem is when I run it through Android studio it installs the APK in device and I check it I get the response mapped properly and consequently updating the UI (I have already rendered multiple graphs! with this response!) (studio runs assembleProdDebug command).But when I am installing the same apk using command line in device "adb install -r ***.apk" the responses are coming null.
This is weird and I sent this apk to client :( before manually installing and verifying this apk and now it is a issue.
Please suggest a solution if you have faced similar kind of issue.