Skip to content

Commit b6231c1

Browse files
tjleingThomas Leing
authored andcommitted
Provide examples of storage pause/resume/start/cancel operations (#5126)
Co-authored-by: Thomas Leing <[email protected]>
1 parent 61d35bc commit b6231c1

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/fragments/lib/storage/android/query-transfers.mdx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ Amplify.Storage.getTransfer("TRANSFER_ID",
1010
operation.setOnProgress( progress -> {});
1111
operation.setOnSuccess( result -> {});
1212
operation.setOnError(error -> {});
13+
14+
// possible actions
15+
operation.pause();
16+
operation.resume();
17+
operation.start();
18+
operation.cancel();
1319
},
1420
{
1521
error -> Log.e("MyAmplifyApp", "Failed to query transfer", error)
@@ -28,6 +34,12 @@ Amplify.Storage.getTransfer("TRANSFER_ID",
2834
operation.setOnProgress { }
2935
operation.setOnSuccess { }
3036
operation.setOnError { }
37+
38+
// possible actions
39+
operation.pause()
40+
operation.resume()
41+
operation.start()
42+
operation.cancel()
3143
},
3244
{
3345
error -> Log.e("MyAmplifyApp","Failed to query transfer", error)
@@ -46,6 +58,12 @@ try {
4658
operation.setOnProgress { }
4759
operation.setOnSuccess { }
4860
operation.setOnError { }
61+
62+
// possible actions
63+
operation.pause()
64+
operation.resume()
65+
operation.start()
66+
operation.cancel()
4967
} catch (error: StorageException) {
5068
Log.e("MyAmplifyApp", "Failed to query transfer", error)
5169
}
@@ -64,6 +82,11 @@ RxAmplify.Storage.getTransfer("TRANSFER_ID")
6482
operation.setOnSuccess( result -> {});
6583
operation.setOnError(error -> {});
6684

85+
// possible actions
86+
operation.pause();
87+
operation.resume();
88+
operation.start();
89+
operation.cancel();
6790
},
6891
error -> Log.e("MyAmplifyApp", "Failed to query transfer", error);
6992
);

0 commit comments

Comments
 (0)