Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

Unable to write on SD card

$
0
0

Hi,

I can't write or simply move a file stored on SD card. I have no exceptions

  • reading/writing files on the phone storage
  • reading files on the SD card

Certainly the permssions are present in the AndroidManifest.xml file

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

and they are given during runtime.

So everytime I try to write on SD card a "System.UnauthorizedAccessException: Access to the path is denied." is thrown.
You can reproduce it with this simple code

            void MoveFile(string path)
            {
                string newpath = path + ".mp3";

                System.IO.File.Move(path, newpath);

                Console.WriteLine("----------------- File moved! ------------------".ToUpper());
            }

Right after the System.IO.File.Move(path, newpath); statement is thrown a System.UnauthorizedAccessException.


Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>