1
狀態在我的應用程序,我通過改造與此代碼上傳圖像AWS:Android的改造RestAdapter得到失敗的斷線
private interface UploadFileToAwsInterface {
@Multipart
@POST("/")
SuccessResponse uploadFile(@Part("key") String key,
@Part("AWSAccessKeyId") String AWSAccessKeyId,
@Part("acl") String acl,
@Part("success_action_redirect") String success_action_redirect,
@Part("policy") String policy,
@Part("signature") String signature,
@Part("utf8") String utf8,
@Part("Content-Type") String contType,
@Part("file") TypedFile file);
}
public Boolean uploadFileToAws(AWSCredentials awsCredentials, File localFile, String mimeType) {
TypedFile file = new TypedFile(mimeType, localFile);
endPoint.setUrl(awsCredentials.getAction());
UploadFileToAwsInterface uploadFileInterface = restAdapter.create(UploadFileToAwsInterface.class);
SuccessResponse response = uploadFileInterface.uploadFile(
awsCredentials.getKey(),
awsCredentials.getAWSAccessKeyId(),
awsCredentials.getAcl(),
awsCredentials.getSuccess_action_redirect(),
awsCredentials.getPolicy(),
awsCredentials.getSignature(),
"true",
mimeType,
file);
圖片上傳工作正常。但是當我啓動圖片上傳和網絡斷開時,我無法獲得迴應。如何在這種情況下獲得失敗?
感謝你,做的工作 – 2015-03-25 08:35:24