I can’t write a file with usb otg

Asked

Viewed 19 times

1

I can read the files in the pen drive folder, but I can’t write.

This is the code I use to try to write:

 string path = "./storage/A691-92EC";

                        string file1 = "usb.txt";


                        if (Directory.Exists(path))
                        {
                            var filename1 = System.IO.Path.Combine(path, file1);
                            System.IO.File.WriteAllText(filename1, "teste");

                        }

this is the mistake that gives:

Access to the path "/Storage/A691-92EC/usb.txt" is denied.

and these are the permissions of android:

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.