I'm building an Android app which uses AWS Amplify to list and download files from S3.
The sample code shows downloading is asynchronous:
Amplify.Storage.downloadFile()
"ExampleKey",
new File(getApplicationContext().getFilesDir() + "/download.txt"),
result -> Log.i("MyAmplifyApp", "Successfully downloaded: " + result.getFile().getName()),
error -> Log.e("MyAmplifyApp", "Download Failure", error)
);
I wish to download the (possibly many) files in a background thread, and notify the main thread after all files have been downloaded (or an error occurred). Questions:
What is the best way to achieve this functionality?
P.S.
I've tried the RxAmplify, which exposes RxJava Observables on which I can call blockingSubscribe()
. However, the bindings are very new, and I've encountered some app-crashing uncaught exceptions using it.