How can we store and retrieve App settings as key,value pair in Xamarin.Forms? Like when the app is closed we can store the user preferences and on restarting of the App we
I use Settings Plugin for Xamarin And Windows for Xamarin.Forms, the upside since this is implemented at the device-level, you can access these settings from any Forms project, PCL library OR your native project within your app.
private const string UserNameKey = "username_key";
private static readonly string UserNameDefault = string.Empty;
public static string UserName
{
get { return AppSettings.GetValueOrDefault(UserNameKey, UserNameDefault); }
set { AppSettings.AddOrUpdateValue(UserNameKey, value); }
}