Forum Visual Studio

Missing sharedPreferences after application reinstall


I've got problem with sharedPreference for Android application developed in Visual Studio.
Each time I've change my code and rebuild the project and start to debug application, sharedPreference settings are lost.

I expected that those settings will be accessable after reinstall.

When I use sharedPreference to store my value and then close down my application. After reopen my app settings are loaded correctly.

I'm using this code:

public string LastLogin
sharedPreference.Edit().PutString(ConstLastLogin, value).Commit();
return sharedPreference.GetString(ConstLastLogin, "");

where for sharedPreference I used several methods:

sharedPreference = PreferenceManager.GetDefaultSharedPreferences(Application.Context);


sharedPreference = context.ApplicationContext.GetSharedPreferences("WMS", FileCreationMode.Private);

How to keep this settings after reinstall?


  • RaphaelSchindlerRaphaelSchindler USMember ✭✭✭

    You do know that the application is reinstalled every time if you don't activate the fast deployment option?

  • Jacek.6393Jacek.6393 USMember

    I actually know that : )
    What I didn't known was 'Preserve application data/cache on device between deploys' option.
    Since I've checked it my application setting are keeped after reinstall.

  • RaphaelSchindlerRaphaelSchindler USMember ✭✭✭

    Good to hear :)

Sign In or Register to comment.