I've a problem with Xamarin.Android, I can save ISharedPreferences while executing application but when I restart the application, the ISharedPreferences looks deleted.
I've a global ISharedPrefereces var called settings
I use in the onCreate() function
settings = Application.Context.GetSharedPreferences("UserInfo", FileCreationMode.Private);
then I test if there is a var saved
if (settings.Contains("user") || settings.GetString("user","") == ""){/*...*/}
if not I start a new activity when the user can log in, I get the user and right with an OnActivtiyResult
and then save
isAdmin = data.GetBooleanExtra("isAdmin", false);
ISharedPreferencesEditor editor = settings.Edit();
editor.PutString("user", data.GetStringExtra("user"));
editor.PutBoolean("isAdmin", isAdmin);
editor.Apply();
As said before, it look saved when I execute the application, cause I read settings
when I need the username, I never save in an other var the user. Thanks for reading.