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

@iamjonny
Copy link

great gist 🔖rooted s20 almost setup but needs resetting due to some really important apps bugging for some weird reason (plus other unknown + suspect system instability issues - magisk lsposed s20 droid13)

am about to try a few backups, to try and restore my system settings and app configs

does auto-backup data require the clouds? eg backup to samsung and google
and is it one backup only?

not sure if new things like neobackup tools are replacements for nandroid, or wrappers.

ideally I'll back up to sd, as laptop ssd is also reportedly on the blink!

  • want to exclude whatsapp, and any other massive apps that can "self-backup"

@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