Search code examples
androidiosxamarinuwpfolder-permissions

Access folder throughout Xamarin app


Is there any folder that can be accessed through a Xamarin.Forms app? The app will be deployed to Android, iOS and as a UWP app. I have a database file and so far, I am using SpecialFolders.Personal, which works for Android and iOS, but not UWP. I would need to get permission for this folder in Windows.

So is there any folder I can use across all 3 devices for which I don't need any special permissions?


Solution

  • Xamarin.Forms has provided Environment.SpecialFolder.LocalApplicationData enum that use to get universal storage path. And it need to be combined with Environment.GetFolderPath method.

    var ApplicationDataPath = Environment.GetFolderPath(SpecialFolder.LocalApplicationData); 
    

    For more please refer File Handling in Xamarin.Forms