What I want to do is to check the md5Hash of a file metadata stored in my firebase Storage, I have done it and its working like this
refToFile.getMetadata().addOnSuccessListener(new OnSuccessListener<StorageMetadata>() {
@Override
public void onSuccess(StorageMetadata storageMetadata) {
String hash = storageMetadata.getMd5Hash();
Log.e("md5hash", "onSuccess: "+hash );
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
// Uh-oh, an error occurred!
}
});
Now, I want to check if that hash is the same as one file I have in my externalStorage (file inside my phone)
What Im trying to do is this
1 .- Download that file from Storage
2 .- Check if that md5Hash has not changed (so I know that the file is not new)
3 .- If I upload the same file and replace it, I will check the file md5Hash from firebase and compare to the md5Hash of the file I stored in my phone, so I know that the file in the Storage is new and I can prompt the user to download that new file
Question
Is there any method to get the md5Hash from a file inside my phone ?
For example
File file = new File();
file.getMd5Hash...
I suppose that the md5Hash of a file downloaded with firebase is the same as the firebase file metadata stored in my phone (because is the same file).