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

后端 未结 8 1023
一生所求
一生所求 2020-12-01 07:54

I am keeping some application meta data in SharedPreferences. Whenever I uninstall the application and reinstall it, the SharedPreferences are dele

相关标签:
8条回答
  • 2020-12-01 08:48

    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.

    See:

    BackupAgentHelper

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

    general Backup guide

    0 讨论(0)
  • 2020-12-01 08:56

    As edthethird said: best lay physical files on device external storage and read them on installation. If the file content needs to be hidden from users just perform a simple encryption/decryption process.

    0 讨论(0)
提交回复
热议问题