I have a PDF and some doc files kept in firebase storage.
How can I download the file from Firebase Storage to the External storage of my device?
public void writeExternalStorage() {
String filename;
String completepath;
mref = FirebaseStorage.getInstance().getReference();
StorageReference filepath = mref.child("MyFiles").child("firstFile.pdf");
InputStream inputStream = null;
File file = null;
FileOutputStream fileOutputStream = null;
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state)) {
try {
file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS).getAbsolutePath() + "/TestPurpose");
// Log.d("PATH", file.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
}
I want to download the Firstfile.pdf file to the External_storage's Document/TestPurpose/ Folder. How it can be done??