1

I am trying to upload image file to my server with ion library.I am using following code

Ion.with(this, "upload_url")
                .setMultipartFile("imagefile", "image/jpeg", new File("file:///storage/emulated/0/Pictures/MyCameraApp/IMG_19700101_000000.jpg"))
                .asJsonObject()
                .setCallback(new FutureCallback<JsonObject>() {
                       @Override
                        public void onCompleted(Exception e, JsonObject result) {
                            Log.w("ERROR",""+e);
                            Log.w("RESULT",""+result);
                        }
                    });

But I am getting:

11-18 19:09:08.465: W/ERROR(1435): com.google.gson.JsonParseException: unable to parse json

What is wrong with this code ?

Okan
  • 1,379
  • 3
  • 25
  • 38
  • 1
    Seems like the response is not Json, but you use `asJsonObject()`. Double-check the response. – shkschneider Jan 19 '15 at 15:34
  • Have you tried different internet service provider ? like using wifi that different with your telco operator. I have the same problem here: https://stackoverflow.com/questions/28696400/ion-cant-be-used-if-using-gprs-connection – Plugie Feb 24 '15 at 13:06

0 Answers0