Name:
interface
Value:
Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.

Page updated Feb 21, 2024

Maintenance ModeYou are viewing Amplify Gen 1 documentation. Amplify Gen 1 has entered maintenance mode and will reach end of life on May 1, 2027. New project should use Amplify Gen 2. For existing Gen 1 projects, a migration guide and tooling are available to help you upgrade. Switch to the latest Gen 2 docs →

Query transfers

When an upload or download operation is requested using the Amplify Android library, the request is first persisted in the local SQLite Database and then queued for execution. You can query the transfer operation queued in the local database using the transfer ID returned by an upload or download API. Get-Transfer API could retrieve a pending transfer previously en-queued and enable attaching a listener to receive updates on progress change, on-error or on-success, or pause, cancel or resume it.

Amplify.Storage.getTransfer("TRANSFER_ID",
operation -> {
Log.i("MyAmplifyApp", "Current State" + operation.getTransferState());
// set listener to receive updates
operation.setOnProgress( progress -> {});
operation.setOnSuccess( result -> {});
operation.setOnError(error -> {});
// possible actions
operation.pause();
operation.resume();
operation.start();
operation.cancel();
},
{
error -> Log.e("MyAmplifyApp", "Failed to query transfer", error)
}
);
Amplify.Storage.getTransfer("TRANSFER_ID",
{ operation ->
Log.i("MyAmplifyApp", "Current State" + operation.transferState)
// set listener to receive updates
operation.setOnProgress { }
operation.setOnSuccess { }
operation.setOnError { }
// possible actions
operation.pause()
operation.resume()
operation.start()
operation.cancel()
},
{
Log.e("MyAmplifyApp", "Failed to query transfer", it)
}
)
try {
val operation = Amplify.Storage.getTransfer("TRANSFER_ID")
Log.i("MyAmplifyApp", "Current State" + operation.transferState)
// set listener to receive updates
operation.setOnProgress { }
operation.setOnSuccess { }
operation.setOnError { }
// possible actions
operation.pause()
operation.resume()
operation.start()
operation.cancel()
} catch (error: StorageException) {
Log.e("MyAmplifyApp", "Failed to query transfer", error)
}
RxAmplify.Storage.getTransfer("TRANSFER_ID")
.subscribe(
operation -> {
Log.i("MyAmplifyApp", "Current State" + operation.getTransferState());
// set listener to receive updates
operation.setOnProgress( progress -> {});
operation.setOnSuccess( result -> {});
operation.setOnError(error -> {});
// possible actions
operation.pause();
operation.resume();
operation.start();
operation.cancel();
},
error -> Log.e("MyAmplifyApp", "Failed to query transfer", error);
);