question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

User Preferences for xplat template working on every supported platform

See original GitHub issue

Currently, 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:open
  • Created 6 months ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

1reaction
sandreascommented, Mar 20, 2023

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.

0reactions
sandreascommented, Mar 20, 2023

so you can store any type and use any encryption method

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)…

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix Visual Studio 2022 Warning CA1416 "Call site ...
NET 6.0 I'm seeing a bunch of warnings that say: CA1416 "This call site is reachable on all platforms. 'SomeClass.SomeMethod' is only supported...
Read more >
Cross-platform attribution – Help Center
A single template supports your app across multiple operating systems (meaning one template works for across all devices).
Read more >
K13422: F5 supported and F5 contributed iApp templates
Each iApp template is user-customizable and allows you to easily edit the configuration it creates.
Read more >
Cross-Platform Mobile Development in Visual Studio
In this article, learn how you can build apps for Android, iOS, and Windows devices by using Visual Studio.
Read more >
Cross-Platform Compilation
The pipeline can run the compilation for each platform simultaneously making the compilation and release process much easier. For an easy setup, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found