Reputation: 390
I am using TransferUitlty class to upload files to S3. Everything is going fine except that after I pause a upload and resume it. the file is uploading from beginning and not from where I paused.
Is this resume method designed for restarting the upload or resuming from where it paused?
Can I use resume method to resume upload even after killing app?
CODE:
private void uploadResume(int id,ProgressBar progress,File f,TextView filelength,ImageView updownststatus){
if(sTransferUtility!=null){
sTransferUtility.resume(id);
observer= sTransferUtility.getTransferById(id);
observer.setTransferListener(new UploadListener(progress, observer,f,filelength,updownststatus));
}
}
Upvotes: 1
Views: 1163
Reputation: 71
Sorry if I am trying to deviate from the topic, So my answer is basically towards file download.
So I was trying to download a resource from Amazon S3. I used transfer observer to know the state of transfer. I was able to pause the download and monitor it's state. However, I was unable to resume the download even after trying using transferUtility.resume(transferId). But then I tried transferObserver.refresh() and I was able to resume the download for my file.
Upvotes: 0
Reputation: 1876
This is by design of Amazon S3. You can pause and resume an upload on if it's a multipart upload. See S3 Multipart Upload Overview. Say you upload a 100Mb file with TransferUtility. The file will be broken into 20 parts, 5mb each, uploaded in parallel. You pause the upload when 3 parts are done and 3 are in process. And you resume it later. TransferUtility will continue the upload from 5mb * 3 = 15mb and it has 17 parts to transfer. That's because each part has be uploaded fully or else it will be discarded.
Upvotes: 0