Download files
Download to file
If you uploaded the data using the key ExampleKey, you can retrieve the data using Amplify.Storage.downloadFile.
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));val file = File("${applicationContext.filesDir}/download.txt")Amplify.Storage.downloadFile("ExampleKey", file,    { Log.i("MyAmplifyApp", "Successfully downloaded: ${it.file.name}") },    { Log.e("MyAmplifyApp",  "Download Failure", it) })try {    val file = File("${applicationContext.filesDir}/download.txt")    val download = Amplify.Storage.downloadFile("ExampleKey", file)    try {        val fileName = download.result().file.name        Log.i("MyAmplifyApp", "Successfully downloaded: $fileName")    } catch (error: StorageException) {        Log.e("MyAmplifyApp", "Download Failure", error)    }}RxProgressAwareSingleOperation<StorageDownloadFileResult> download =        RxAmplify.Storage.downloadFile(            "ExampleKey",            new File(getApplicationContext().getFilesDir() + "/download.txt"        );
download    .observeResult()    .subscribe(        result -> Log.i("MyAmplifyApp", "Successfully downloaded: " + result.getFile().getName()),        error -> Log.e("MyAmplifyApp",  "Download Failure", error)    );Track download progress
To track progress of the download, use the downloadFile API that includes a progress listener callback.
Amplify.Storage.downloadFile(        "ExampleKey",        new File(getApplicationContext().getFilesDir() + "/download.txt"),        StorageDownloadFileOptions.defaultInstance(),        progress -> Log.i("MyAmplifyApp", "Fraction completed: " + progress.getFractionCompleted()),        result -> Log.i("MyAmplifyApp", "Successfully downloaded: " + result.getFile().getName()),        error -> Log.e("MyAmplifyApp",  "Download Failure", error));val file = File("${applicationContext.filesDir}/download.txt")val options = StorageDownloadFileOptions.defaultInstance()Amplify.Storage.downloadFile("ExampleKey", file, options,    { Log.i("MyAmplifyApp", "Fraction completed: ${it.fractionCompleted}") },    { Log.i("MyAmplifyApp", "Successfully downloaded: ${it.file.name}") },    { Log.e("MyAmplifyApp", "Download Failure", it) })val file = File("${applicationContext.filesDir}/download.txt")val options = StorageDownloadFileOptions.defaultInstance()val download = Amplify.Storage.downloadFile("ExampleKey", file, options)val progressJob = activityScope.async {    download.progress().collect { progress ->        Log.i("MyAmplifyApp", "Fraction completed: ${progress.fractionCompleted}")    }}try {    val fileName = download.result().file.name    Log.i("MyAmplifyApp", "Successfully downloaded: $fileName")} catch (error: StorageException) {    Log.e("MyAmplifyApp", "Download Failure", error)}progressJob.cancel()RxProgressAwareSingleOperation<StorageDownloadFileResult> download =        RxAmplify.Storage.downloadFile(remoteKey, localFile);
download    .observeProgress()    .subscribe(      progress -> Log.i("MyAmplifyApp", progress.getFractionCompleted())    );Generate a download URL
You can also retrieve a URL for the object in storage:
Amplify.Storage.getUrl(    "ExampleKey",    result -> Log.i("MyAmplifyApp", "Successfully generated: " + result.getUrl()),    error -> Log.e("MyAmplifyApp", "URL generation failure", error));Amplify.Storage.getUrl(    "ExampleKey",    { Log.i("MyAmplifyApp", "Successfully generated: ${it.url}") }    { Log.e("MyAmplifyApp", "URL generation failure", it) })try {    val url = Amplify.Storage.getUrl("ExampleKey").url    Log.i("MyAmplifyApp", "Successfully generated: $url")} catch (error: StorageException) {    Log.e("MyAmplifyApp", "URL generation failure", error)}RxAmplify.Storage.getUrl("ExampleKey").subscribe(    result -> Log.i("MyAmplifyApp", "Successfully generated: " + result.getUrl()),    error -> Log.e("MyAmplifyApp", "URL generation failure", error));