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/topics/data/backup.jd | 66 ++++++++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 17 deletions(-) (limited to 'docs/html/guide/topics') 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