获取 Android 的 DavidWebb 上传进度

Get progress of upload with DavidWebb for Android

我在这个答案中找到了要上传的代码:https://codereview.stackexchange.com/a/55472

Webb webb = Webb.create();
Response<String> response = webb
        .post("http://www.example.com/service")
        .body(new File("camera/myfile.jpg"))
        .connectTimeout(10 * 1000)
        .asString();

if (response.isSuccess()) {
    String outcome = response.getBody();

    // ...

} else {
    System.out.println(response.getStatusCode());
    System.out.println(response.getResponseMessage());
    System.out.println(response.getErrorBody());
}

但是如何跟踪上传进度?

如您所见,分段上传

此库的功能不可用,因此您无法获取上传文件的进度。

您需要使用MultiPart 将文件上传到服务器。更多here