Wednesday, October 16, 2013

Xamarin: Saving and loading preferences in Android

Loading and saving preferences on Xamarin.Android should be done through the ISharedPreferences interface.

Here’s a quick sample to save preferences:

And another one to load them again:


Shruti Ramalingam said...
This comment has been removed by a blog administrator.
Advexp Components said...

You can use "Advexp.Settings Local" ( ) to store any build-in or user-defined types and it collections in NSUserDefaults or KeyChain for iOS and SharedPreferences or KeyStore for Android. Interaction with settings occurs like with any variable or property in C#. This component support iOS, Android and PCL and it is unit tested. Also JSON serialization is supported. Ability to create app settings together with InAppSettingsKit ( ) and interaction with system Settings App for iOS. For more details see component`s examples.

Also you can use "Advexp.Settings Cloud" ( ). This component has all Advexp.Settings Local functionality + ability to save settings to Amazon Cognito Sync cloud ( ) and sync them across the different devices (iOS or Android)

Project site:

"Advexp.Settings Local" Xamarin component:
"Advexp.Settings Cloud" Xamarin component:

NuGet package “Advexp.Settings Local”:
NuGet package “Advexp.Settings Cloud”, evaluation version: