Automatic Backup of Android – Non-Rooted

I like to dabble around on Android Enthusiast, as part of a hobby. Recently, I had to pay an absurd amount of money to get the onboard units of my Samsung S7 Edge replaced because KNOX enabled it’s Custom Binary Lock upon reboot, not allowing me to enter my phone.

Apart from some minor technicalities, it got me thinking: how can I achieve a full device backup, without root privileges? The process is not quick, but I have found a few solutions for myself.

Whilst it would be preferable that the solution is entirely automatic, and not require a computer, there are limitations without root privileges.

Of course, not one solution will fit all use cases. For me, I do not want to use Cloud Storage unless I can validate the data is encrypted and secure. For you, Google Drive or DropBox may be sufficient.

 

Q: Using Windows Explorer – will it work?

A: Directory-based scenarios are ok.

If you’re looking at simply backing up directories (and not the applications) then a simple directory backup will suffice. This will not necessarily backup applications, but will save content for local apps.

For example, if we had a password manager with a local database, then making backups of the MDB file (or whatever format) would be simple. This, of course, does not ensure the application referencing and accessing this database is saved – you need to perform another function to backup the application itself.

Q: What’s the usage in this process?

A: Simple File-Managers can perform the trick.

Allowing your Linux, MacOSX or Windows PC access to the device’s storage allows you to simply copy the directories at will – a simple cut and paste can perform the job.

If you would like to automate it, of course, it can be scripted; a service (cron) setup to automatically perform this function could be configured.  If you wanted to somehow automate the process, implementing DSyncronize to mimic the directory is a valid option as well.

Q: Can we automate this process?

A: Yes, it is possible.

Using Automate, we can have the following flow to perform a function:

 

FTP.png

FTP Workflow

 

Pretty self-explanatory, at a certain time during the day (when we assume we’re home, and on the local LAN) we zip directories and then upload to an FTP location; for security, I’d recommend using a NAS with account authentication.

Q: Would ADB be able to perform this function?

A: Well yeah, of course!

The first thing you’re going to need to perform is to enable USB Debugging on your phone, which is simple:

  • Go to Settings and About Device
  • Click on Software Info and tap Build Number 7 times
  • Go back, then select Developer Options and Enable USB Debugging

Then, you will need to download the Android Software Development Kit (SDK) and install onto your PC. Note if you are on Linux the packages are:

  • android-tools-adb
  • android-tools-adbd

Launch the program, make a new setting (profile), and download the additional components to perform the function. I just downloaded all packages as it’s easier.

For reference, ADB commands should be as follows:

adb backup [-f <file>] [-apk|-noapk] [-obb|-noobb] [-shared|-noshared] [-all] [-system|nosystem] [<packages...>]

So, let’s go ahead and make a full device backup:

adb backup -apk -shared -all -nosystem -f Name-Of-Backup.ab

This is a standard backup of all applcations, shared storage and no system applications. The parameters are:

  • -apk | -noapk: Back up or do not back up .apk files. The default value is -noapk.
  • -shared | -noshared: Back up or do not back up shared storage. The default value is -noshared.
  • -all: Back up all installed applications.
  • -system | -nosystem: Include or do not include system apps when backing up all installed applications (-all). The default value is -system.

Once completed, in the directory you specified (-f) you will have your file. If you need to edit the ADB file, read here.

There are, of course, scripts out there to automate the process (to a degree), and other apps that work on PC if preferred.

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s