koush / ion

Android Asynchronous Networking and Image Loading
Other
6.29k stars 1.03k forks source link

android 10 it doesn't work #949

Closed ghost closed 3 years ago

ghost commented 3 years ago

Image upload works well on Android 7. But it doesn't work on Android 10. The request cannot be received from the server. What is the problem?

Ion.with(this) .load(UPLOAD_URL) .setMultipartParameter("name", value) .setMultipartFile("image", "image/jpeg", new File(imageName)).asJsonObject().withResponse().setCallback((e, result) -> { if(e != null) { Toast.makeText(this, "Error is: " + e.getMessage(), Toast.LENGTH_SHORT).show(); } else { switch (result.getHeaders().code()) { case 500: Toast.makeText(this, "Image Uploading Failed. Unknown Server Error.", Toast.LENGTH_SHORT).show(); break; case 200: Toast.makeText(this, "success", Toast.LENGTH_SHORT).show(); break; } } });