Closed joakimmag closed 6 years ago
Version Number of Plugin: 3.1.1 Device Tested On: Nexus 5X Version of VS: 15.7.3 Version of Xamarin: 3.0.0 Versions of other things you are using:
Don't know if relevant but using a simple wrapper class and dependency injection with Prism.
Should load saved settings.
When close and reopen app, it loads the settings that were saved.
When reboot, loads old settings I saved a long time ago.
Deleted app and app data from phone settings. But still it fetches old settings.
App.xaml.cs
protected override void RegisterTypes(IContainerRegistry containerRegistry) { containerRegistry.RegisterInstance<ISettings>(CrossSettings.Current); containerRegistry.RegisterSingleton<IProperties, Properties>();
Properties.cs
public Properties(ISettings settings) { Settings = settings; } private ISettings Settings { get; } private string GetValue(string key) => Settings.GetValueOrDefault(key, null); private void SetValue(string key, string value) => Settings.AddOrUpdateValue(key, value); public string Username { get => GetValue(nameof(Username)); set => SetValue(nameof(Username), value); }
ConfigurationPageViewModel.cs
var u = Properties.Username; // Breakpoint. At this point it will read the correct value. After reboot, it will read the old value from a long time ago.
Update: After reset phone to factory settings, the problem is gone. It will save/retrieve as expected.
Bug Information
Version Number of Plugin: 3.1.1 Device Tested On: Nexus 5X Version of VS: 15.7.3 Version of Xamarin: 3.0.0 Versions of other things you are using:
Steps to reproduce the Behavior
Don't know if relevant but using a simple wrapper class and dependency injection with Prism.
Expected Behavior
Should load saved settings.
Actual Behavior
When close and reopen app, it loads the settings that were saved.
When reboot, loads old settings I saved a long time ago.
Deleted app and app data from phone settings. But still it fetches old settings.
Code snippet
App.xaml.cs
Properties.cs
ConfigurationPageViewModel.cs