Search code examples
androidsqlitesharedpreferencesupdatesreinstall

Save data in android to use after update


I want to save an int and a boolean in my android-app. At the moment I use sharedPreferences to save the variables. What happens if I update my app or reinstall it?

Should I better use a database for saving the variables?


Solution

  • The SharedPreferences will get deleted. But if you use a BackupAgentHelper (more information here), you could back up your preferences to the cloud.

    If you want to do it without internet access, you could save your data to the sd-card.