Looking for suggestion on storage

Phunction 206 Reputation points
2024-02-05T16:22:48.54+00:00

I am look for a suggestion on file storage with .net Maui. In my existing .net Android app, I am reading/writing files to a custom folder in the device root basicall /myfolder, this allows the user to connect and transfer files to/from the device easily with windows explorer, they just have to go to /device/myfolder

It appears I am unable to do that in .net Maui, even though I ask for and have external storage read/write and even manage.

How can I setup my app to allow for something like this? Reading/writing files to the units /my documents or /downloads would be best but from what I can find you cannot get write permission to these folders. These are custom files and I would like to be able to let the user transfer files via their PC usb connection and still have those files available for reading/writing in the app.

How do people normally deal with this?

I also allow the user to make backups to the external storage card, is that possible with .net Maui?

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,900 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Phunction 206 Reputation points
    2024-04-25T19:43:18.8333333+00:00

    Ok, I cannot figure out why .net maui will not work.

    On my Xamarin.Android version, I have no problems creating and saving files where I need, I use the read external and write external permissions. (I didn't need to use MANAGE_EXTERNAL_STORAGE)

    In the .net maui version, I keep getting permission errors. I ask for and am granted the same write and read external storage permissions, I double check the grants and it does say granted for those two, but it will not let me do anything. Also, it looks like maui does not provide a MANAGE_EXTERNAL_STORAGE option. I added it to the android manifest file but no diff.

    The maui code I use for the permissions:

    PermissionStatus status = await Permissions.CheckStatusAsync<Permissions.StorageRead>();
    
    and
    
    PermissionStatus status = await Permissions.CheckStatusAsync<Permissions.StorageWrite>();
    
    

    But there is no manage storage options.

    I am willing to force them to just use a Dropbox ore Onedrive and tie them into the app for the main files but I really need a way to allow the user to backup files to their SD card. The app is used where there is no internet access and it is important to have running backups incase the unit dies or gets damaged.