I want to get data from a server by Ion. I have this problem: just when run the project I can get data, but for other times I can not get any response. My code is:
public void GetData(final Context context, final String user_id){
Ion.with(context)
.load(Url+ "/user?")
.setLogging("Data", Log.DEBUG)
.setMultipartParameter("user_id", user_id)
.asJsonObject()
.setCallback(new FutureCallback<JsonObject>() {
@Override
public void onCompleted(Exception e, JsonObject result) {
if(e == null){
List<String> messages = new ArrayList<String>();
String status = result.get(STATUS).getAsString();
if (status.equals(Success)) {
EventBus.getDefault().post(new mainClass.GetDataMessage(messages, status));
}
}
}
});
}
When I debug it, it does not entry onCompleted() and comes out from Getdata. On LogCat there is this:
05-09 19:54:59.073 1278-1278/com.example.com D/Data: (۰ ms) http://URL?: preparing request
05-09 19:54:59.077 1278-1278/com.example.com I/Data: (۰ ms) http://:Url? Using loader: com.koushikdutta.ion.loader.HttpLoader@53cc2d6c
05-09 19:54:59.089 1278-1488/com.example.com D/Data: (۰ ms) http://Url?: Executing request.