When it comes to computers, smartphones or just anything electronics in general it’s always a good idea to have a backup. The Apple iTunes ecosystems allows a user to easily create a backup from your phone that includes your data, settings, literally everything with just a touch of a button. So even if you lose or break your device you can simply buy a new one and restore your backup. It’s as if it never happened.
However things on Android have never been that easy. Users with a rooted device could always use Titanium Backup to backup all applications and settings but I haven’t heard of an application that allows this on non-rooted devices. I reckon that technically it’s not possible without root access as applications don’t have the permissions to access the /system/app/ folder where all the installed applications reside.
Luckily, there seems to be a way now to backup your Android phone with the help of ADB – the android debug bridge from the android SDK. Keep in mind that your phone needs to have at least Android 4.0 running. As this hasn’t been publicised explicitly as a new feature of ICS I would still treat is experimental. From my personal experience I can tell that it works rather well, otherwise I wouldn’t be writing about it.
Before we start, I am going to assume that you’ve already installed the Android SDK and updated the SDK Platform Tools to the latest version using the SDK Manager.
To Backup your phone:
- Connect your phone via usb and make sure that you have enabled usb debugging in the developer options. Open up a command / terminal prompt
- Optionally you can type the command “adb devices”
1: chriss-mbp:~ chris$ adb devices
2: List of devices attached
3: 047c58661c9162b9 device
5: chriss-mbp:~ chris$
- The command ‘adb backup’ allows you to create a full backup of your android device
The command syntax: [ command ] : optional argument
adb backup [ -f
] [ -apk | -noapk ] [ -shared | -noshared ] [ -all ] [ -system | -nosystem ] [ ]
The following basic command will use the defaults to backup only application and device data without the APKs itself to the file ‘backup.ab’ in your current working directory
You might need to specify the backup file in case the following error occurs:
“adb: cannot open file ./backup.ab”
adb backup -all -f C:\backup.ab
Explanation of parameters:
specifies where the backup file will be saved.
-apk | -noapk
flag sets whether or not the APK’s of an application should be included in the backup or simply the application’s respective data. The default is -noapk. I highly recommend -apk just in case the apk is not available anymore from the market. Saves hunting down the apk on some dubious 3rd party file hoster.
-shared | -noshared
flag sets whether the device’s shared storage (included memory of the device), usually mounted at /sdcard/ is backed up. The default is -noshared. I highly recommend this for nexus devices as they have no external micro-sd card slot and all the pictures/music are saved on the internal storage. Still use a PC to backup your pictures/music manually or use something like Dropbox or G+ Auto-Upload. Better safe than sorry.
flag set whether to backup all the applications or just backup the app specified by the
flag sets whether or not the -all flag will also include system applications or not. When I backup my phone I always use -system just in case. I guess when restoring your backup to a new phone with a higher Android version it would be advisable / safer to use -nosystem.
Once you’ve have made your decision on what to backup, simply type the command into the terminal. I usually use:
adb backup -apk -shared -all -system -f ~/backups/nexus4_20130901.db
A screen like this will appear on our Android device:
You can enter a password to encrypt the backup. You will need this password to restore the backup. Thus make sure not to forget or don’t set one.
This process can take several minutes up to a couple of hours, depending on the settings you have chosen, especially when you included the shared storage. As soon as the backup completes, a toast message will appear saying “Backup Complete”
To Restore your phone:
With your device connected enter the following command into command prompt / terminal
adb restore ~/backups/nexus4_20130901.db
replacing ~/backups/nexus4_20130901.db with the location of your backup file.
A screen like this will appear on your Android device:
Type in your current encryption password in case you set one and press ‘Restore my data’ to begin the restore. Again it can take several minutes up to a couple of hours. After the restore your should system should be back just like when you created the backup short of some widgets and wallpaper on the homescreen. My alarms remained and for most applications it even kept my login. It kept everything.
NOTE: This will not backup your SMS. I suggest using something like SMS Backup & Restore