bmgr
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
bmgr
是一項殼層工具,可讓您在 Android 裝置 2.2 (API 級別 8) 以上版本中與備份管理員互動。這項工具會提供指令來啟動備份與還原作業,如此一來就不必重複抹除資料或採取類似的干擾步驟,以便測試應用程式的備份功能。bmgr
工具支援自動備份和金鑰/數值備份。
注意:bmgr restore
不適用於加密備份。
您可以透過 adb shell 在裝置上執行 bmgr
指令,然後使用 logcat 監控指令的輸出內容。如需可用指令的清單和說明,請執行 bmgr
工具 (不含引數)。如要瞭解如何觸發備份與還原作業,請參閱「測試備份與還原」。
如需在應用程式中新增備份支援的資訊,請參閱資料備份一文
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間: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)"]]