androidamazon-web-servicesamazon-s3awss3transferutility

TransferUtility S3 resume does not work


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));
    }
}

Solution

  • 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.