I am using intentService for making http calls with Ion. On Wifi it works well but when I switch to data network things start breaking.
Ion.with(Application.getApplicationContext())
.load(url)
.as(new TypeToken<Object>() {})
.withResponse()
.setCallback(new FutureCallback<Response<Object>>() {
@Override
public void onCompleted(Exception e, Response<Object> response) {
if(e == null) {
Bundle bundle = new Bundle();
bundle.putSerializable("result", (Serializable) response.getResult());
rec.send(response.getHeaders().code(), bundle);
}
}
});
Above is the code which i am using in IntentService I am getting "java.io.IOException:non 2xx status line:HTTP/1.1 500 internal server error."