简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM