Hello,
Welcome to our Microsoft Q&A platform!
DirectoryDocuments PRIVATE_EXTERNAL_STORAGE/Documents in exteranl storage,
Due to the android 11 limitation. you cannot store file to external storage,
You can try to use string testPath = Android.App.Application.Context.GetExternalFilesDir("").AbsolutePath + $"filename.txt";
path. It will store your file to the package folder
Here is my demo code to store file.
string testPath = Android.App.Application.Context.GetExternalFilesDir("").AbsolutePath + $"filename.txt";
using (System.IO.FileStream os = new System.IO.FileStream(testPath, System.IO.FileMode.Create))
{
var charData = "this is a test text".ToCharArray();
var byData = new byte[charData.Length];
os.Write(byData,0, byData.Length);
os.Close();
}
Best Regards,
Leon Lu
If the response is helpful, please click "Accept Answer" and upvote it.
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.