下载pdf文件并使用Retrofit 1.9保存到SD卡

时间:2017-12-07 13:04:27

标签: android retrofit android-download-manager

使用Retrofit 1.9库进行API调用。功能需要下载.pdf文件并将其保存到SD卡。我试图使用Callback回调,但得到错误字符串不能被套装到响应体。问题是我得到字符串格式的响应,但我需要将文件保存到SD卡。任何想法如何使用改造1.9实现这一点。

public interface ApiInterface {
        @Headers({"Content-Type: application/json", "Accept: application/json", "Media-Type: application/json"})
        @GET("/user/statements")
        void getPDF(Callback<String> callback);
    }


getAsyncApi().getPDFResponse(new Callback<String>() {

            @Override
            public void success(String responseBody, retrofit.client.Response response) {
            retrofit.client.Response response1 = response;
            }

            @Override
            public void failure(RetrofitError error) {

            }
        });

如何从响应中保存此pdf?

0 个答案:

没有答案