views:

281

answers:

2

I'm looking at AndroidManifest files and I see entries for android:backupAgent and according to the Documentation android:backupAgent is

The name of the class implementing BackupAgent to manage backup and restore of the application's settings to external storage.

But I can't find a BackupAgent interface or any other documentation. Can someone point me in the right direction?

+2  A: 

BackupAgent's API is not solidified yet, so it's a hidden class. You can check it out on Android's git, where there is this comment:

/**
 * This is the central interface between an application and Android's
 * settings backup mechanism.
 * 
 * @hide pending API solidification
 */
Daniel Lew
Looks like it's going to be handy!
CaseyB
+1  A: 

All I can offer is the source code for android.app.BackupAgent and the source code for android.backup.BackupManager.

BackupAgent is an abstract class and according to the javadoc in the source it "is the central interface between an application and Android's settings backup mechanism." It has abstract onBackup() and onRestore() methods.

There is also BackupManager. The javadoc says "BackupManager is the interface to the system's backup service. Applications simply instantiate one, and then use that instance to communicate with the backup infrastructure." It has a dataChanged() method to call to schedule a backup and a beginRestoreSession() method to start a restore.

Now, the interesting things in the code for BackupManager are:

*
* @hide pending API solidification
*/

and:

/** @hide TODO: REMOVE THIS */
public static final boolean EVEN_THINK_ABOUT_DOING_RESTORE = true;

So it seems that this is still a work in progress and the EVEN_THINK_ABOUT_DOING_RESTORE member variable is an easy way to disable backup functionality. My guess is that it is disabled in production Android builds.

Dave Webb