Question: I'm developing a client application in **Xamarin.Forms** (Android, iOS and Windows Phone) which will contact the server to get the user data. In this application i need to store the user settings like User Preferences, Server Url, UserName, authentication token . . . etc.

Can anyone suggest me a **standard** and **best** way to store the application user settings?

Thanks in advance.

Answer: 
Use [SettingsPlugin](https://github.com/jamesmontemagno/SettingsPlugin) to store the user settings as you required. This will help to access settings from shared code across all of your mobile apps.

The following code:

```
public static class Settings 
{

    private static ISettings AppSettings
    {
        get
        {
            return CrossSettings.Current;
        }
    }

    //Setting Constants

    const string UserName = "username";
    private static readonly string UserNameDefault = string.Empty;

    public static string UserName
    {
        get { return AppSettings.GetValueOrDefault<string>(UserName, UserNameDefault); }
        set { AppSettings.AddOrUpdateValue<string>(UserName, value); }
    }
}

```
You can use the Cross Platform [Settings API](https://github.com/jamesmontemagno/SettingsPlugin) developed by the Xamarin Team as a Plugin:

```
public class AppPreferences
{
    static ISettings AppSettings => CrossSettings.Current;

    public static string UserName
    {
      get { return AppSettings.GetValueOrDefault<string>(UserNameKey, UserNameDefault); }
      set { AppSettings.AddOrUpdateValue<string>(UserNameKey, value); }
    }
}

```

Follow the link above for more info on how to add this package to your solution.