I'm having a problem with writing to my external sd card. I'm getting a UnauthorizedAccessException
whenever I try to write to it. I've already checked WriteExternalStorage
in the Android Manifest.
Because GetExternalStoragePublicDirectory
, ExternalStorageDirectory
etc. are all returning the path to the internal storage, I'm using a manual path, /storage/6363-3065/
. If I'm writing to my internal storage, the program runs without error, but it throws an Exception when writing to the sd card.
Can I do anything to solve this? I mean, it can't be impossible, because other programs like my file manager can do it without root or anything...
Edit:
I'm using a LG G4 with Android 6.0. Code is simple:
string filepath = "/storage/6363-3065/Temp/tempfile.temp";
Directory.CreateDirectory(Path.GetDirectoryName(filepath));