Skip to content

Instantly share code, notes, and snippets.

@kaneelyster
Last active July 17, 2024 14:28
Show Gist options
  • Save kaneelyster/1dc3c7265240f2a8478918c9642da79d to your computer and use it in GitHub Desktop.
Save kaneelyster/1dc3c7265240f2a8478918c9642da79d to your computer and use it in GitHub Desktop.
Auto Backup ADB commands

Good write-up here.

Enable ADB verbose logging for backups:
adb shell setprop log.tag.GmsBackupTransport VERBOSE
adb shell setprop log.tag.BackupXmlParserLogging VERBOSE

Force auto backup:
adb shell bmgr backupnow <PACKAGE>

Force full backup:
adb shell bmgr fullbackup <PACKAGE>

Force all pending backup operations to run immediately by using the bmgr run command:
adb shell bmgr run

At this point you can uninstall and reinstall the app to be prompted to restore when opening it again.

Get the backup token: adb shell dumpsys backup | grep Current

Force restore:
adb shell bmgr restore <TOKEN> <PACKAGE>

If you want to wipe the backup and can't do it because the it is unclear how to call the wipe properly you could try to disable and enable the auto backup.
adb shell bmgr enable false
adb shell bmgr enable true

@kaneelyster
Copy link
Author

@iamjonny Auto backup does app and user data backup to your Google Drive. It is set per app by the app developer. It is not a system or device backup.

I highly recommend reading more here. This does not sound like what you're looking for. The commands in this gist are purely to trigger the backup and restore processes of a single app you're developing yourself and have enabled auto backup for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment