I have a method that will copy an Audio file from raw folder to SD card
. It takes two inputs
Use this for path:
string baseDir = Environment.getExternalStorageDirectory().getAbsolutePath();
string path = baseDir + File.Separator + "music" + File.Separator + "yourpackagename" + filename;
Please don't hardcode paths. Use Environment.getExternalStorageDirectory() to get the path of a large storage medium. Some phones mount sdcards in /mnt/sdcard or somewhere else, some just don't have one and rely on inbuilt flash.
This might throw the error, but I don't think is the error in this case since you are probably testing with your phone/emulator, where this path applies.
My problem has nothing to do with the code. It is a permission-related thing. I added the permission inside the application tag
. It must be outside it. It must be in the root tag
.
Wired for me because it make sense to put it in the application tag
not the Manifest tag
!
Thanks for your answers !