I am trying to backup / restore the general settings of my application, I performed this step using the Android backup service:
In Manifest.xmlin tag<application>
<meta-data android:name="com.google.android.backup.api_key" android:value="My Key" />
added this class:
public class MyBackupAgent extends BackupAgentHelper {
static final String PREFS = "my_preferences";
@Override
public void onCreate() {
SharedPreferencesBackupHelper helper = new SharedPreferencesBackupHelper(this, PREFS);
addHelper(Utilities.SETTINGS_KEY, helper);
}
}
when the set value is for general preference I do this:
BackupManager backupManager = new BackupManager(context);
backupManager.dataChanged();
But if I uninstall / reinstall the application, the changes are not applied ...
source
share