From 337b0873f43eac5f23483bec94bd8729f79d47ec Mon Sep 17 00:00:00 2001 From: Scott Main Date: Fri, 25 Jun 2010 15:55:57 -0700 Subject: docs: update backup guide and bmgr tool elaborate the guide to testing a backup agent and add links between the docs Change-Id: I35f815d1848c6bd7c6bfaee214f333e35a6cb23c --- docs/html/guide/developing/tools/bmgr.jd | 13 +++++++ docs/html/guide/topics/data/backup.jd | 66 ++++++++++++++++++++++++-------- 2 files changed, 62 insertions(+), 17 deletions(-) (limited to 'docs') diff --git a/docs/html/guide/developing/tools/bmgr.jd b/docs/html/guide/developing/tools/bmgr.jd index 2f49532..57deb25 100644 --- a/docs/html/guide/developing/tools/bmgr.jd +++ b/docs/html/guide/developing/tools/bmgr.jd @@ -15,6 +15,11 @@ page.title=bmgr
  • Other Commands
  • +

    See also

    +
      +
    1. Data Backup
    2. +
    + @@ -26,6 +31,9 @@ and restore operations so that you don't need to repeatedly wipe data or take si intrusive steps in order to test your application's backup agent. These commands are accessed via the adb shell. +

    For information about adding support for backup in your application, read Data Backup, which includes a guide to testing +your application using {@code bmgr}.

    Forcing a Backup Operation

    @@ -90,6 +98,8 @@ will happen even if your application is not currently running.

    Other Commands

    +

    Wiping data

    +

    The data for a single application can be erased from the active data set on demand. This is very useful while you're developing a backup agent, in case bugs lead you to write corrupt data or saved state information. You can wipe an application's data with the bmgr wipe @@ -102,6 +112,9 @@ you wish to erase. The next backup operation that the application's agent processes will look as though the application had never backed anything up before. + +

    Enabling and disabling backup

    +

    You can see whether the Backup Manager is operational at all with the bmgr enabled command: diff --git a/docs/html/guide/topics/data/backup.jd b/docs/html/guide/topics/data/backup.jd index 4e74a83..4279d7d 100644 --- a/docs/html/guide/topics/data/backup.jd +++ b/docs/html/guide/topics/data/backup.jd @@ -33,7 +33,7 @@ page.title=Data Backup

  • Checking the Restore Data Version
  • Requesting Backup
  • Requesting Restore
  • -
  • Developing and Testing Your Backup Agent
  • +
  • Testing Your Backup Agent
  • Key classes

    @@ -43,6 +43,11 @@ page.title=Data Backup
  • {@link android.app.backup.BackupAgentHelper}
  • +

    See also

    +
      +
    1. {@code bmgr} tool
    2. +
    + @@ -308,7 +313,7 @@ backup for all applications that have requested a backup since the last backup w

    Tip: While developing your application, you can initiate an immediate backup operation from the Backup Manager with the bmgr tool.

    +href="{@docRoot}guide/developing/tools/bmgr.html">{@code bmgr} tool.

    When the Backup Manager calls your {@link android.app.backup.BackupAgent#onBackup(ParcelFileDescriptor,BackupDataOutput,ParcelFileDescriptor) @@ -452,7 +457,7 @@ android.app.backup.BackupManager#requestRestore(RestoreObserver) requestRestore( href="#RequestingRestore">Requesting restore for more information).

    Note: While developing your application, you can also request a -restore operation with the bmgr +restore operation with the {@code bmgr} tool.

    When the Backup Manager calls your {@link @@ -813,7 +818,7 @@ onBackup()}.

    Note: While developing your application, you can request a backup and initiate an immediate backup operation with the bmgr +href="{@docRoot}guide/developing/tools/bmgr.html">{@code bmgr} tool.

    @@ -828,25 +833,52 @@ android.app.backup.BackupAgent#onRestore(BackupDataInput,int,ParcelFileDescripto implementation, passing the data from the current set of backup data.

    Note: While developing your application, you can request a -restore operation with the bmgr +restore operation with the {@code bmgr} tool.

    -

    Developing and Testing Your Backup Agent

    +

    Testing Your Backup Agent

    -

    To develop and test your backup agent:

    - +
  • Ensure that backup is enabled + +
  • +
  • Open your application and initialize some data +

    If you've properly implemented backup in your application, then it should request a +backup each time the data changes. For example, each time the user changes some data, your app +should call {@link android.app.backup.BackupManager#dataChanged()}, which adds a backup request to +the Backup Manager queue. For testing purposes, you can also make a request with the following +{@code bmgr} command:

    +
    adb shell bmgr backup your.package.name
    +
  • +
  • Initiate a backup operation: +
    adb shell bmgr run
    +

    This forces the Backup Manager to perform all backup requests that are in its +queue.

    +
  • Uninstall your application: +
    adb uninstall your.package.name
    +
  • +
  • Re-install your application.
  • + + +

    If your backup agent is successful, all the data you initialized in step 4 is restored.

    + -- cgit v1.1