Page updated Jan 16, 2024

Remove files

Amplify Android v1 is now in Maintenance Mode until May 31st, 2024. This means that we will continue to include updates to ensure compatibility with backend services and security. No new features will be introduced in v1.

Please use the latest version (v2) of Amplify Library for Android to get started.

If you are currently using v1, follow these instructions to upgrade to v2.

Amplify libraries should be used for all new cloud connected applications. If you are currently using the AWS Mobile SDK for Android, you can access the documentation here.

To delete an object uploaded to S3, use Amplify.Storage.remove and specify the key:

1Amplify.Storage.remove(
2 "myUploadedFileName.txt",
3 result -> Log.i("MyAmplifyApp", "Successfully removed: " + result.getKey()),
4 error -> Log.e("MyAmplifyApp", "Remove failure", error)
5);
1Amplify.Storage.remove("myUploadedFileName.txt",
2 { Log.i("MyAmplifyApp", "Successfully removed: ${it.key}") },
3 { Log.e("MyAmplifyApp", "Remove failure", it) }
4)
1try {
2 val result = Amplify.Storage.remove("myUploadedFileName.txt")
3 Log.i("MyAmplifyApp", "Successfully removed: ${result.key}")
4} catch (error: StorageException) {
5 Log.e("MyAmplifyApp", "Remove failure", error)
6}
1RxAmplify.Storage.remove("myUploadedFileName.txt")
2 .subscribe(
3 result -> Log.i("MyAmplifyApp", "Successfully removed: " + result.getKey()),
4 error -> Log.e("MyAmplifyApp", "Remove failure", error)
5 );