The strength of Android OS lies in enumerable number of apps present in Google Play Store as well as other standalone sources. We use many of them quite regularly be it for social networking, games, banking, reading and many more. While using these apps they generate their own internal data for smooth running which is called as app data. e.g. If you are playing games, various levels that have been completed get stored, in an eBook app the eBooks you download are saved and likewise. Now in unfortunate events like the phone screen gets broken or hardware failure or someone deliberately putting a pattern lock/password or the phone is stolen etc. it is highly likely that you will lose all the data as after repair the servicing personnel will reset the phone. In such situations it is quite handy if we have backup of app data that can be restored.
Normally if you want to do backup and restore from phone alone, you need to root it. There are plenty of apps available which can accomplish this task on a rooted android device. But for unrooted device ADB (Android Debug Bridge) is a great tool for backing up apps as well as app data. ADB is a command line tool and has vast uses. Let’s see how we can use it for backup and restore operations.
Firstly you will need to enable ADB in your phone’s Developer Options. Secondly you will need PC running Windows with ADB package installed. Moreover when we want to backup any app, you’ll have to specify the correct package name for that app. There is very handy app called ApkExtractor where you can see package name for every app installed on your phone. Now connect your phone to PC with USB cable and open ADB. Type in
adb devices
You should see serial number of your connected phone.
Now note down the package names of the apps you want to backup from Apkextractor app on phone.
1. To backup app data along with apk
Type in this command:
adb backup -f “D:\myfolder\myapp.ab” -apk <package name>
-f parameter specifies the file location, -apk specifies to backup apk (and not only app data)
Once you enter this command on PC you will be prompted to unlock phone screen. Unlock screen and select ‘Back Up Data’ and also enter password if you have set up any previously. This command will store the backup to myapp.ab file on your PC. To restore this back to your phone simply type in:
adb restore “D:\myfolder\myapp.ab”
This command will restore entire app back to your phone.
2. To backup only app data
To backup only data don’t pass -apk parameter. This will only backup the app data in myapp.ab file. Remember that before you restore this backup the app should already be installed on the phone (From play store or from apk file which you are supposed to have).
3. To backup multiple apps
If you need to backup more than one app put in all package names in <package name> parameter with single space between each name. Alternatively if you want to backup all apps on phone you can use:
adb backup -f “D:\myfolder\myapp.ab” -all -apk -nosystem
-nosystem parameter is used to exclude system apps from backup, as restoring system apps sometimes causes stability issues.
Illustrations:
1. Backup ‘Candy Crush Saga’ game
The package name for Candy Crush Saga is com.king.candycrushsaga as seen in Apkextractor app. To backup this app, command would be
adb backup -f “D:\myfolder\myapp.ab” -apk com.king.candycrushsaga
Now your game will be saved in myapp.ab file. When you restore this file with ‘adb restore’ function complete game will be restored back to phone with all the achievements and levels intact.
- Backup Candy Crush Saga and Facebook
Type in this command:
adb backup -f “D:\myfolder\myapp.ab” -apk com.king.candycrushsaga com.facebook.katana
This command will backup both Candy Crush Saga and Facebook apps in one myapp.ab file. You may add n number of apps in this manner simultaneously.
Some facts about ADB Backup function:
- ADB Backup works only on Android version 4.0 and above.
- You can restore backup to another Android device (of another manufacturer) only if it is running higher version of Android.
- There is no provision of conditional restore i.e. you can’t choose specific items from backup file.
- ADB Backup is still little buggy and it is advisable to also explore other options (like rooting phone).