Writing to the Externally Mounted SD Card Android

I am trying to write data to an externally mounted SD card in my Unity app. Everywhere I’ve looked, people mention using Application.persistentDataPath, but this is writing files to /storage/emulated/0/Android/data/<bundle-identifier>/files.

I would like to try to write to the externally mounted SD card first before using the persistent data path listed above. I already have a function that will return to me one of the following if it exists:

  • /storage/extSdCard
  • /storage/sdcard1
  • /storage/usbcard
  • /storage/sdcard0

before using the persistent data path as a last resort.

The problem is that every time I try and create a directory using Directory.CreateDirectory (<externally mounted sd path>) I get an UnauthorizedAccessException.

Is there any special way that I need to be using to write the the mounted SD card?

I’ve already checked if the WRITE_EXTERNAL_STORAGE permission is being included in the manifest and it is.

Thanks for all the help.

Bump, this needs answers. Got the same problem.