public class BackupManager extends Object
When an application has made changes to data which should be backed up, a
dataChanged() will notify the backup service. The system
will then schedule a backup operation to occur in the near future. Repeated
dataChanged() have no further effect until the backup
operation actually occurs.
A backup or restore operation for your application begins when the system launches the
BackupAgent subclass you've declared in your manifest. See the
BackupAgent for a detailed description
of how the operation then proceeds.
Several attributes affecting the operation of the backup and restore mechanism
can be set on the
tag in your application's AndroidManifest.xml file.
For more information about using BackupManager, read the Data Backup developer guide.
|Constructor and Description|
Constructs a BackupManager object through which the application can communicate with the Android backup system.
|Modifier and Type||Method and Description|
Begin the process of restoring data from backup.
Notifies the Android backup system that your application wishes to back up new changes to its data.
Convenience method for callers who need to indicate that some other package needs a backup pass.
Restore the calling application from backup.
public void dataChanged()
BackupAgentsubclass will be scheduled when you call this method.
public static void dataChanged(String packageName)
This method requires that the application hold the "android.permission.BACKUP" permission if the package named in the argument does not run under the same uid as the caller.
packageName- The package name identifying the application to back up.
public int requestRestore(RestoreObserver observer)
If this method returns zero (meaning success), the OS will attempt to retrieve
a backed-up dataset from the remote transport, instantiate the application's
backup agent, and pass the dataset to the agent's
RestoreObserverto receive callbacks during the restore operation. This must not be null.