Udostępnij za pośrednictwem


BackupManager.RequestRestore(RestoreObserver) Method

Definition

This member is deprecated.

[Android.Runtime.Register("requestRestore", "(Landroid/app/backup/RestoreObserver;)I", "GetRequestRestore_Landroid_app_backup_RestoreObserver_Handler")]
public virtual int RequestRestore (Android.App.Backup.RestoreObserver? observer);
[<Android.Runtime.Register("requestRestore", "(Landroid/app/backup/RestoreObserver;)I", "GetRequestRestore_Landroid_app_backup_RestoreObserver_Handler")>]
abstract member RequestRestore : Android.App.Backup.RestoreObserver -> int
override this.RequestRestore : Android.App.Backup.RestoreObserver -> int

Parameters

observer
RestoreObserver

The RestoreObserver to receive callbacks during the restore operation. This must not be null.

Returns

Zero on success; nonzero on error.

Attributes

Remarks

This member is deprecated. Applications shouldn't request a restore operation using this method. In Android P and later, this method is a no-op.

<p>Restore the calling application from backup. The data will be restored from the current backup dataset if the application has stored data there, or from the dataset used during the last full device setup operation if the current backup dataset has no matching data. If no backup data exists for this application in either source, a non-zero value is returned.

<p>If this method returns zero (meaning success), the OS attempts to retrieve a backed-up dataset from the remote transport, instantiate the application's backup agent, and pass the dataset to the agent's android.app.backup.BackupAgent#onRestore(BackupDataInput, int, android.os.ParcelFileDescriptor) onRestore() method.

<p class="caution">Unlike other restore operations, this method doesn't terminate the application after the restore. The application continues running to receive the RestoreObserver callbacks on the observer argument. Full backups use an android.app.Application Application base class while key-value backups use the application subclass declared in the AndroidManifest.xml <application> tag.

Java documentation for android.app.backup.BackupManager.requestRestore(android.app.backup.RestoreObserver).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to