User Preferences for xplat template working on every supported platform
See original GitHub issueCurrently, I’m trying to develop a small Cross Platform application based on the xplat template. Unfortunately, I cannot find a solution for saving user preferences, that does work for every major platform:
- Desktop (Windows, Linux, macOS) - required
- Android - required
- iOS - required
- WASM - nice to have
I unsuccessfully tried different existing solutions:
- Xam.Plugins.Settings - did not work for NETCORE projects
- Xamarin.Essentials - successor of the first one, same error
- SimpleStorage - no Provider for Desktop
<MauiEssentials/>
- Could not install into the project (Package 'Microsoft.Maui.Essentials.Runtime.any 7.0.59' has a package type 'DotnetPlatform' that is not supported by project
)- Lager - seems very old / unmaintained
I asked for help via Telegram, but unfortunately nobody suggested alternatives to these. Related discussion: https://github.com/AvaloniaUI/Avalonia/discussions/9915
Describe the solution you’d like
I cannot think of any App that does not need to store user preferences (e.g. an API URI), so I would love to see a solution that works similar to <MauiEssentials>
for every supported platform like this:
Preferences.Set
Preferences.Get
Preferences.Remove
Preferences.Clear
Preferences.ContainsKey
Best case scenario would be a full integration into the xplat
template, but I could live with an add-in package providing nuget packages for each platform sharing a common interface.
I also considered encrypted / secret storage for tokens and credentials, but for now I would be happy with a simple unencrypted / insecure storage.
Issue Analytics
- State:
- Created 6 months ago
- Reactions:2
- Comments:5
Top GitHub Comments
Today I started a project for this: https://github.com/sandreas/Avalonia.Preferences I need help for Android compatibility and lots of other stuff. Every feedback and help is welcome.
Yeah sure, I know that. I might sound a little picky, but there are some native mechanisms (like Preserve settings on uninstall), that cannot be used easily with that approach. Sorry for bugging you with that, but I think it might be worth checking out, how others do this (Maui, Xamarin)…