次の方法で共有


IBackupHelper.PerformBackup Method

Definition

Based on oldState, determine what application content needs to be backed up, write it to data, and fill in newState with the complete state as it exists now.

[Android.Runtime.Register("performBackup", "(Landroid/os/ParcelFileDescriptor;Landroid/app/backup/BackupDataOutput;Landroid/os/ParcelFileDescriptor;)V", "GetPerformBackup_Landroid_os_ParcelFileDescriptor_Landroid_app_backup_BackupDataOutput_Landroid_os_ParcelFileDescriptor_Handler:Android.App.Backup.IBackupHelperInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public void PerformBackup (Android.OS.ParcelFileDescriptor? oldState, Android.App.Backup.BackupDataOutput? data, Android.OS.ParcelFileDescriptor? newState);
[<Android.Runtime.Register("performBackup", "(Landroid/os/ParcelFileDescriptor;Landroid/app/backup/BackupDataOutput;Landroid/os/ParcelFileDescriptor;)V", "GetPerformBackup_Landroid_os_ParcelFileDescriptor_Landroid_app_backup_BackupDataOutput_Landroid_os_ParcelFileDescriptor_Handler:Android.App.Backup.IBackupHelperInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member PerformBackup : Android.OS.ParcelFileDescriptor * Android.App.Backup.BackupDataOutput * Android.OS.ParcelFileDescriptor -> unit

Parameters

oldState
ParcelFileDescriptor

An open, read-only android.os.ParcelFileDescriptor pointing to the last backup state provided by the application. May be null, in which case no prior state is being provided and the application should perform a full backup.

data
BackupDataOutput

An open, read/write BackupDataOutput pointing to the backup data destination. Typically the application will use backup helper classes to write to this file.

newState
ParcelFileDescriptor

An open, read/write android.os.ParcelFileDescriptor pointing to an empty file. The application should record the final backup state here after writing the requested data to the data output stream.

Attributes

Remarks

Based on oldState, determine what application content needs to be backed up, write it to data, and fill in newState with the complete state as it exists now.

Implementing this method is much like implementing BackupAgent#onBackup(ParcelFileDescriptor, BackupDataOutput, ParcelFileDescriptor) onBackup() &mdash; the method parameters are the same. When this method is invoked the oldState descriptor points to the beginning of the state data written during this helper's previous backup operation, and the newState descriptor points to the file location at which the helper should write its new state after performing the backup operation. <p class="note"> <strong>Note:</strong> The helper should not close or seek either the oldState or the newState file descriptors. It is essential that when reading the helper's saved state from the oldState file, no extra content is consumed beyond what was stored by this helper. If more old state data is read, even accidentally, it will make it impossible for additional helpers that may be invoked after this one to properly reconstruct their prior state.

Java documentation for android.app.backup.BackupHelper.performBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor).

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