List files
You can list all of the objects uploaded under a given prefix. This will list all public files:
1Amplify.Storage.list("",2 result -> {3 for (StorageItem item : result.getItems()) {4 Log.i("MyAmplifyApp", "Item: " + item.getKey());5 }6 },7 error -> Log.e("MyAmplifyApp", "List failure", error)8);
You can also list private or protected files by passing options. For example, to list all protected files owned by a user identified by the ID otherUserID
:
1StorageListOptions options = StorageListOptions.builder()2 .accessLevel(StorageAccessLevel.PROTECTED)3 .targetIdentityId("otherUserID")4 .build();5
6Amplify.Storage.list(7 "",8 options,9 result -> {10 for (StorageItem item : result.getItems()) {11 Log.i("MyAmplifyApp", "Item: " + item.getKey());12 }13 },14 error -> Log.e("MyAmplifyApp", "List failure", error)15);