xamarin android external sd

Phunction 176 Reputation points

Hi, I am trying to allow the user to save backups to the external SD card, but I am not able to access that with android 11 and up.
From what I have been reading, this should give the needed path:

However, this is the internal documents folder. I am unable to fid a way to access Documents folder on the SD card, does anyone know how to do so?

A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
4,813 questions
No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 11,296 Reputation points Microsoft Employee


    Referring to this documentation Storage updates in Android 11, we could note that Android 11 has updated the storage mechanism.

    App-specific directory on external storage
    Starting in Android 11, apps cannot create their own app-specific directory on external storage. To access the directory that the system provides for your app, call getExternalFilesDirs().

    For usage sample and more detailed explanations, you could refer to [getExternalFilesDir](https://developer.android.com/reference/android/content/Context#getExternalFilesDir(java.lang.String\)).

    I am trying to allow the user to save backups to the external SD card.

    Using this API for saving backups could be more safety, due to these files are internal to the application.

    Best Regards,

    Alec Liu.

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.