It is not very complicated, first you create a path where the file is stored in firebase
StorageReference pathReference = storageRef.child("images/stars.jpg");
Then you create a FilePath inside the device where the file will be saved
File localFile = File.createTempFile("images", "jpg");
Finally you get the file with getFile()
pathReference.getFile(localFile).addOnSuccessListener(new OnSuccessListener<FileDownloadTask.TaskSnapshot>() {
@Override
public void onSuccess(FileDownloadTask.TaskSnapshot taskSnapshot) {
// Local temp file has been created
//Aqui ya obtuviste el archivo, asi que puedes chequear su tamaño con
un log
Log.e("Tamaño del archivo",""+datasnapshot.getByteCount(); //creo que era byte count pero con un get byte obtenias el tamaño del archivo
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
// Handle any errors
}
});
Then if you want you can put localFile.getAbsolutePath()
and get where you have saved the txt file
I hope you serve, everything I wrote you got from the official documentation of firebase, where you can find how to save in memory, and other storage options, I recommend you read the documentation here