Tech —

Android 6.0 has a great auto backup system that no one is using (yet)

The new system works, but apps will need to be tweaked to meet the requirements.

We recently published a rather lengthy review of Google's newest operating system, Android 6.0 Marshmallow, but there was one feature we couldn't get working in time for the review: the new automatic backup feature for app data. The theory is that this feature would take all your app data, stick it in the cloud, and when you restore your phone or buy a new one, it would be like nothing ever changed—all your settings and logins would come back like magic.

"Theory" is the key word, since we only had Google's descriptions and the behavior of the Android M Developer Preview to go on for the review. One week and lots of research later, we think we've nailed down how the system works in the final version. What follows is a rewrite of the backup section that we'll paste into the review, but since it is 95 percent new content and information, we're giving it a separate article, too.

If you've had any experience with the Developer Preview's backup behavior, it really doesn't apply to the final version. The Developer Preview took a brute force "back up everything" approach to app data, which in part was for Google's testing to see how such a system would work. The final version takes a safer, consumer-ready route that has a lot more restrictions for what gets backed up.

What existed before

Android has always had some kind of cloud component that backs up some amount of data. At first there was only Google's Sync infrastructure, which is in the settings under "accounts." The sync framework will back up your Google data to your Google account. This is really basic stuff like Gmail, Contacts, IMs (on Google Talk/Hangouts), Google Calendar events, and Drive documents. As the name implies, this system also handles "syncing" data between the phone and the cloud—it's your push notifications. Sync only backs up the core data from these apps. It usually misses your preferences and notification settings, making it an incomplete solution.

Android users invest a lot of time in the widgets and icons on their home screens, too. It wasn't until the Google Now Launcher launched that Google started backing up the home screen layout of devices. Now, when you restore a device that had the Google Now Launcher, you'll have your icons, folders, and widgets put back where they were. The layout even shows grayed out icons for apps that have their position saved but haven't been downloaded yet.

The other thing Google has done since the early days of Android is reinstall apps associated with your account. If you wipe a device and sign back in, Google Play will proceed to download and install every app it had a record of being on your device. Early versions of this service were rather flaky. Users weren't told about what apps would be restored; they just logged in and (maybe, hopefully) their devices began downloading things. In Lollipop, Google revamped the service and it became a lot more reliable. During the initial setup, users were shown a list of their saved device profiles and could pick one. It also showed the list of apps that would be restored and let users pick and choose which ones they wanted to keep—a big improvement from the "sign in and hope" method of older versions.

While the apps were re-downloaded, though, the data associated with those apps was never saved. All the apps that were reinstalled would be in the "new user" state. Then it was up to the user to start the painful, arduous process of tapping on every single app icon and setting the app up, either by logging in to a third-party service or clearing "warm welcome" messages and tutorials so the app could start receiving notifications and behaving normally.

While apps have usually restored with zero data, the situation is a lot better for games. Google Play Games has a "Saved Games" feature that third-party apps can use to store game data exactly like you would expect. You hit level 60 and can save that data in the cloud, and then even after wiping your device, you can just sign back in to Play Games and the save will be there. This is also an easy way to take progress with you when you move from a phone to a tablet—the save will sync across devices.

Since Android 2.2, Android has made an old app data backup system available to developers, but it was complicated enough that not many developers used it. They had to write their own backup agent, deal with conflicts from multiple devices, and the service was only recommended for "less than a megabyte" of data. This is what is being replaced by the new backup system.

The new backup system: When it works, it works

With Marshmallow, Android swaps out the old data backup system for a new one, called "Auto Backup for Apps." This new system just dumps the app's entire contents of /data/data/[app-name] (minus the cache and temporary files) into Google Drive. It's a backup of basically everything—data, settings, and even logins to third-party services. The documentation on the feature rather plainly states, "On devices running Android 6.0 (API level 23) or higher, the default system behavior is to back up almost all data that an app creates." All the tutorial flags will be cleared, and if the developer does everything right, even push notifications will start working without the user having to do anything.

Developers do get some control over the new system. They can tweak exactly what gets backed up if they want to or completely opt out of the system (users can turn the system off, too). Restore won't just work for apps from the Play Store, either. Sideloaded apps and apps from third-party app stores should also have their app data restored when they are installed.

The user interface for this feature partially lives in the Google Drive app. Head to the settings and there will be options for a section titled "Auto Backup for Apps." The "Manage Backups" page will show you a list of apps that are backed up and how much space they use, but there currently aren't any ways to "manage" these backups. This screen shows everything you have backed up, using either the new or old backup system. There's no way to inspect exactly what got backed up, just that something from the app was saved. Being able to directly see the list and confirm that your data is backed up is great for peace of mind, at least. For our purposes, the list was great for troubleshooting as well.

Apps running on the new backup system aim to save their data every 24 hours, but there are a few requirements for the backup system to trigger automatically. The new backup system uses the JobScheduler API introduced in Lollipop and only triggers a backup if the device is connected to power, on Wi-Fi, and has been idle for at least an hour. The data then gets encrypted and uploaded to Google Drive. Google provides the storage to everyone for free—each app is limited to 25MB and doesn't count against the user's Google Drive storage quota.

The new backup system has been moved out of the operating system and into Google Play Services, which should allow Google to easily update the system if it wants to. Being in Google Play Services doesn't mean it will work on older versions, though—app backup will only work on devices with Marshmallow and above.

Channel Ars Technica