相关疑难解决方法(0)

BackupAgentHelper:onRestore 未被调用

我从此链接安装了示例 BackupRestore。

https://android.googlesource.com/platform/development/+/0b3758ea4e53f9bfd0b112eaa4a7dd7b7f4040f5/samples/BackupRestore?autodive=0%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F

我无法恢复数据。

OnBackup 和 OnCreate 会被调用,但 OnRestore 不会被调用。

我能够备份:OnCreate 和 OnBackup 受到攻击,但 OnRestore 却没有。

@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 …
Run Code Online (Sandbox Code Playgroud)

android android-backup-service backup-agent

1
推荐指数
1
解决办法
1209
查看次数