I installed the example BackupRestore from this link.
I am unable to restore the data.
OnBackup and OnCreate get called, but OnRestore does not.
I am able to backup: OnCreate and OnBackup get hit, but OnRestore does not.
@Override
public void onRestore(BackupDataInput data, int appVersionCode,
ParcelFileDescriptor newState) throws IOException {
// Hold the lock while the FileBackupHelper restores the file from
// the data provided here.
synchronized (BackupRestoreActivity.sDataLock) {
super.onRestore(data, appVersionCode, newState);
}
}
public void onRestoreButtonClick(View v) {
Log.v(TAG, "Requesting restore of our most recent data");
mBackupManager.requestRestore(
new RestoreObserver() {
public void restoreFinished(int error) {
/** Done with the restore! Now draw the new state of our data */
Log.v(TAG, "Restore finished, error = " + error);
populateUI();
}
}
);
}
I have tried using the adb tools (besides requestRestore) and it is not working either.
adb shell bmgr restore [package]
adb uninstall [apkfile]
adb install [apkfile]
When I run restore I get:
restoreStarting: 1 packages
restoreFinished: 0
done
But OnRestore does not get hit, and the data is not restored.
I am using Android Studio 3.0. And I have spent many hours on this. Can anyone shed some light?