Modifying SharedPreferences after install (restored through BackupManager)
-
29-05-2021 - |
Question
My app has the ability to backup and restore SharedPreferences
using an BackupAgentHelper
class. However there are two entries that must not restored.
Is there a way to reset them after restoring again?
I don't want to put them in a different SharedPreference
, they have to be in the same file.
La solution
Use the onBackup or onRestore methods of the BackupAgent to clear out the values before or after the operation.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow