Chris Hall bio photo

Chris Hall

Principal Technical Consultant

PolarCloudsUK Chris LinkedIn Github
Chris Hall Nutanix Certified Master - Multicloud Infrastructure 6 Chris Hall VMware vExpert 2024 Nutanix Certified Professional - Cloud Integration Chris Hall Nutanix Certified Professional - Multicloud Infrastructure 6 Chris Hall Nutanix Certified Professional - Unified Storage 6 Chris Hall VMware vExpert 2023 Chris Hall VMware vExpert 2022

Android Backup and Restore Probably a bit late for the Xmas/new year rush of new Android kit now… hey ho, I was going to write this post over the Xmas break… but there you go, better late than never.

So here is a great tip for backing up and restoring Android application data (including saved games!) or even copying those saved games to a new device. This method works for pretty much any Android app that comes as an install from the Google Play store. Nothing is more annoying that getting to level 9999 on Candy Crush (yeah I know exaggeration, but you get my drift) and then have to start again when you get a new device or your device suffers some other fate and all is lost…

The secret here is we are going to use the Android Debug Bridge to do the hard work for us. Whats more, we can complete all of this without having to root our devices!!

Overview

Setting Up Android Debug Bridge (ADB)

There are loads and loads of guides on the internet to help you set up ADB. I highly recommend using the Minimal ADB and Fastboot Tool to save on downloading the whole Android emulator stack.

This guide to setting up ADB covers Windows, OS X and Linux.

Personally, I use my Linux Mint laptop to do all things Android / ADB using the android-tools-adb package. Android under Windows is a pain what with device drivers and all that faff. Linux is nice, just plug in you device and away you go.

Enable USB Debugging On Your Device

Again, have a look at this guide to enabling USB debuging on your device. Simple.

Choosing What to Back Up

This should be the easy part! You know what games / apps you want to back up right? OK, for the sake of an example lets use Block Puzzle as an example app for the backup and restore process.

I need to find the app’s package name as it would be installed on the device. The simplest way I’ve found to find an app’s package name is look at the app’s entry in google play. Specifically the URL.

Using our example: https://play.google.com/store/apps/details?id=biz.mtoy.blockpuzzle.revolution. From this I can tell that the app’s package name is “biz.mtoy.blockpuzzle.revolution”. Make a note of the package name.

The reason I chose block puzzle is that yep, I have just 1 or 360 plus completed levels on my Nexus 5 so far: ADB01

Backing Up App Data

Right, so you:

  • have adb installed.
  • have enabled USB debugging on your device
  • know the package names of the apps with data that what you want to backup

Lets double check that we have visibility of the device via ADB using the command:

adb devices

ADB02

You should see a device listed as shown above. Your device ID will be different to mine.

On to the backup. The adb data backup command takes this form:

adb backup -f <Backup-File> <Package-Name>

So plumbing block puzzle into this command:

adb backup -f biz.mtoy.blockpuzzle.revolution.ab biz.mtoy.blockpuzzle.revolution

biz.mtoy.blockpuzzle.revolution.ab is the name of my data back up file biz.mtoy.blockpuzzle.revolution is the name of app whos data we are backing up

I like to name my data backup files to match the package name as that make sense to me. You can call your data backup files whatever you like!

Like this: ADB03

At the device end: ADB04

Just hit “BACKUP MY DATA” and give it a moment. The size of backup data varies from app to app. Some mamage a few kB. The biggest backup I’ve seen is around the 50MB mark!

Double checking backup file size on my laptop, it looks like we have application data from the device! ADB05

Repeat the command for any other application data you would like to backup.

Restoring App Data

First off, install the application as normal. For the demo restore here, I’m going to restore my saved games from my Nexus 5 phone to another device, my Nexus 7 (2012) tablet.

So install the app: ADB06

Oh no’s! No saved games (as expected): ADB07

No fear. The ADB data restore command takes this form:

adb restore <Backup-File>

So plumbing block puzzle into this command:

adb restore biz.mtoy.blockpuzzle.revolution.ab

Like this: ADB08

At the tablet end: ADB09

Hit “RESTORE MY DATA” and give it a moment.

Lets launch block puzzle again and check.

Winner, winner: ADB10

Right I’m off to play block puzzle on my tablet… :o)

Till the next time.

-Chris