I am keeping some application meta data in SharedPreferences. Whenever I uninstall the application and reinstall it, the SharedPreferences 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?
You should add a
BackupAgentHelperto your app. Together with theSharedPreferenceBackupHelper, it backups theSharedPreferencesto the cloud (if the device supports it). When the app is reinstalled the data is restored.See:
BackupAgentHelper
SharedPreferenceHelper (contains all the code you need to implement it)
general Backup guide