Skip to content

Most visited

Recently visited

added in API level 8

Contains the backup and restore functionality available to applications. If a user wipes the data on their device or upgrades to a new Android-powered device, all applications that have enabled backup can restore the user's previous data when the application is reinstalled.

For more information, see the Data Backup guide.

All backup and restore operations are controlled by the BackupManager. Each application that would like to enable backup and preserve its data on remote strage must implement a backup agent. A backup agent can be built by extending either BackupAgent or BackupAgentHelper. The BackupAgentHelper class provides a wrapper around BackupAgent that simplifies the procedures to implement a backup agent by employing backup helpers such as SharedPreferencesBackupHelper and FileBackupHelper.

The backup APIs let applications:

  • Perform backup of arbitrary data to remote storage
  • Easily perform backup of SharedPreferences and files
  • Restore the data saved to remote storage


BackupHelper Defines the calling interface that BackupAgentHelper uses when dispatching backup and restore operations to the installed helpers. 


BackupAgent Provides the central interface between an application and Android's data backup infrastructure. 
BackupAgentHelper A convenient BackupAgent wrapper class that automatically manages heterogeneous data sets within the backup data, each identified by a unique key prefix. 
BackupDataInput Provides the structured interface through which a BackupAgent reads information from the backup data set, via its onRestore() method. 
BackupDataInputStream Provides an InputStream-like interface for accessing an entity's data during a restore operation. 
BackupDataOutput Provides the structured interface through which a BackupAgent commits information to the backup data set, via its onBackup() method. 
BackupManager The interface through which an application interacts with the Android backup service to request backup and restore operations. 
FileBackupHelper A helper class that can be used in conjunction with BackupAgentHelper to manage the backup of a set of files. 
FullBackupDataOutput Provides the interface through which a BackupAgent writes entire files to a full backup data set, via its onFullBackup(FullBackupDataOutput) method. 
RestoreObserver Callback class for receiving progress reports during a restore operation. 
SharedPreferencesBackupHelper A helper class that can be used in conjunction with BackupAgentHelper to manage the backup of SharedPreferences
This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields


Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (April 2018 — Developer Survey)