Victor Grazi Victor Grazi - 1 year ago 87
Android Question

In android is there any way to preserve SharedPreferences after an uninstall

I am keeping some application meta data in

. Whenever I uninstall the application and reinstall it, the
are deleted.

Is there any way to get that to remain, so that if the user does an uninstall and reinstall, they can recover their old data?

Answer Source

You should add a BackupAgentHelper to your app. Together with the SharedPreferenceBackupHelper, it backups the SharedPreferences to the cloud (if the device supports it). When the app is reinstalled the data is restored.



SharedPreferenceHelper (contains all the code you need to implement it)

general Backup guide

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download