I have a .txt file inside my raw folder. I want to get the uri of the file and create a new file to upload to firebase.
The idea is simple
- Get the txt file from my res/raw resources
- Upload it to firebase storage
I have done this
String path = "android.resource://" + getPackageName() + "/" + "raw/grupos.txt";
Uri file = Uri.fromFile(new File(path));
but when I call
riversRef.putFile(file)
.addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {....
it says that the file is invalid
LOGCAT
java.io.FileNotFoundException: /android.resource:/com.example.usuario.ottasubirarchivos/raw/grupos.txt: open failed: ENOENT (No such file or directory)
I don't know if I need to get the path of the resource file, create a new file inside the internal storage, get that file and upload it to firebase, or either use stream... I don't know how to handle this... Thanks