# Access denied writing files on USB

**URL:** <https://forum.magicleap.cloud/t/access-denied-writing-files-on-usb/5331>\
**Category:** Unity Development\
**Tags:** development, unity, openxr\
**Created:** [March 12, 2025, 9:18am UTC](https://forum.magicleap.cloud/t/access-denied-writing-files-on-usb/5331 "2025-03-12T09:18:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![filo.cino](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.magicleap.cloud/filo.cino/32/2307_2.png) [@filo.cino](https://forum.magicleap.cloud/u/filo.cino)\
**Post date:** [March 12, 2025, 9:18am UTC](https://forum.magicleap.cloud/t/access-denied-writing-files-on-usb/5331/1 "2025-03-12T09:18:40Z")

</div>

Hello,

**Unity Editor version** : 3.10.0  
**ML2 OS version** : 1.11.0  
**Unity SDK version** : 2022.3.9  
**Host OS** : Windows

I’m developing a Unity app for Magic Leap 2 and encountering write permission issues when trying to create a folder on a connected USB drive. It seems the USB is mounted as internal storage, but I’m getting ‘access denied’ errors. I’ve already modified the **`AndroidManifest.xml`** to include **`READ_EXTERNAL_STORAGE`** and **`WRITE_EXTERNAL_STORAGE`** permissions (even if USB is under /storage/XXXX-XXXX), and adjusted the Player Settings in Unity. Has anyone else experienced this, and are there specific APIs or workarounds recommended for writing to USB drives in this configuration?

I can read and copy files from the USB device…

Many thanks 😀

---

<div class="post-metadata">

**Author:** ![kbabilinski](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.magicleap.cloud/kbabilinski/32/19_2.png) [@kbabilinski](https://forum.magicleap.cloud/u/kbabilinski)\
**Post date:** [March 13, 2025, 6:14pm UTC](https://forum.magicleap.cloud/t/access-denied-writing-files-on-usb/5331/2 "2025-03-13T18:14:42Z")

</div>

It sounds like you’re running into Android’s scoped storage restrictions, which got stricter starting from Android 10. Even if your USB drive mounts under `/storage/XXXX-XXXX`, Android often treats it as external storage, meaning standard permissions alone (`READ_EXTERNAL_STORAGE` and `WRITE_EXTERNAL_STORAGE`) aren’t enough.

I’d recommend looking at this repo **[UnitySimpleFileBrowser](https://github.com/yasirkula/UnitySimpleFileBrowser)** —it uses Storage Access Framework which should resolve the ‘access denied’ error you’re facing.

---

<div class="post-metadata">

**Author:** ![filo.cino](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.magicleap.cloud/filo.cino/32/2307_2.png) [@filo.cino](https://forum.magicleap.cloud/u/filo.cino)\
**Post date:** [March 17, 2025, 7:39am UTC](https://forum.magicleap.cloud/t/access-denied-writing-files-on-usb/5331/3 "2025-03-17T07:39:16Z")

</div>

I’ll give it a try, thanks!

Edit: Even using UnitySimpleFileBrowser and its handlers, it still gives me permission denied

---

<div class="post-metadata">

**Author:** ![kbabilinski](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.magicleap.cloud/kbabilinski/32/19_2.png) [@kbabilinski](https://forum.magicleap.cloud/u/kbabilinski)\
**Post date:** [March 17, 2025, 4:01pm UTC](https://forum.magicleap.cloud/t/access-denied-writing-files-on-usb/5331/4 "2025-03-17T16:01:43Z")

</div>

We use the standard Android 10 storage access so the only thing I can think of is that something with the API or Storage Access Frame work is not configured correctly. Note that even when using SAF you won’t be able to use a traditional file path like `/storage/xxx-xxx` Instead you will need to use the URI (the path returned by the system)

You may be able to access / create directories with SAF by adding `android:requestLegacyExternalStorage="true" ` to your manifest.
