I'm using the following code to download a file from Firebase storage:
[Source: https://firebase.google.com/docs/storage/android/download-files]
islandRef = storageRef.child("images/island.jpg");
File localFile = File.createTempFile("images", "jpg");
islandRef.getFile(localFile).addOnSuccessListener(new OnSuccessListener<FileDownloadTask.TaskSnapshot>() {
@Override
public void onSuccess(FileDownloadTask.TaskSnapshot taskSnapshot) {
// Local temp file has been created
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
// Handle any errors
}
});
However, I've noticed that Firebase keeps retrying when there is no Internet.
That's why I've also tried:
mStoragePath.setMaxDownloadRetryTimeMillis(60000);
mStoragePath.setMaxOperationRetryTimeMillis(60000);
mStoragePath.setMaxUploadRetryTimeMillis(60000);
But this is just setting the maximum timeout value. Is it possible to fail the operation in a single try.
Thanks.