Files not visible to xamarin app

era148 1 Reputation point
2021-04-19T22:25:08.243+00:00

I am saving and loading files from external storage. I am attempting to utilize CSVs and allow users to add their own data that the app can then load. This is why I have opted for external storage because from what I have read internal storage is not accessible for the user to move files from say the downloads folder. I have followed the docs here https://learn.microsoft.com/en-us/xamarin/android/platform/files/external-storage?tabs=windows

I have read and write storage permissions enabled. I cannot figure out why though, but only files made by the app in that session are visible. If I save a file and then attempt to load from the directory using Directory.GetFiles() only that saved file loads. If I then completely close and reopen the app that file is no longer visible and any new files I save then attempt to load during that session are visible, but then again disappear once I close the app. If I take a CSV and move it onto my phone then into that folder it is never visible to the app. In all cases Directory.GetFiles() returns a string[] and its length is 0. Anyone have any ideas what I could be doing wrong?

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,297 questions
{count} votes