bmgr
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
bmgr
是一款 shell 工具,可用于与搭载 Android 2.2(API 级别 8)或更高版本的设备上的备份管理器进行交互。该工具提供了用于启动备份和恢复操作的命令,这样您就无需重复擦除数据或执行类似的干扰性步骤来测试应用的备份功能。bmgr
工具支持自动备份和键/值对备份。
注意:bmgr restore
不适用于加密备份。
您可以通过 adb shell 在设备上运行 bmgr
命令,然后使用 logcat 监控命令的输出。如需查看可用命令的列表和说明,请直接运行 bmgr
工具,而不要提供任何参数。如需了解如何触发备份和恢复操作,请参阅测试备份和恢复。
如需了解如何在应用中支持备份,请参阅数据备份
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# bmgr\n\n`bmgr` is a shell tool you can use to interact with the Backup Manager on Android\ndevices version 2.2 (API Level 8) or higher. The tool provides commands to initiate backup and\nrestore operations so that you don't need to repeatedly wipe data or take similar intrusive steps\nin order to test your application's backup functionality. The `bmgr` tool supports both\n[Auto Backup](/guide/topics/data/autobackup) and\n[Key/Value Backup](/guide/topics/data/keyvaluebackup).\n\nNote: `bmgr restore` does not work for\n[encrypted backups](/guide/topics/data/autobackup#define-device-conditions).\n\nYou run `bmgr` commands on a device via\n[adb shell](/studio/command-line/adb) and then monitor the output of the commands\nwith [logcat](/studio/command-line/logcat). For a list and description of\navailable commands, run the `bmgr` tool with no arguments. For information on\ntriggering backup and restore operations, see\n[Testing Backup and Restore](/guide/topics/data/testingbackup).\n\nFor information about adding support for backup in your application, read [Data Backup](/guide/topics/data/backup)"]]