Android has always lagged behind iOS when it comes to backing up a smartphone owners' settings, apps and data. Over the years, Android has gotten better at this. It started syncing settings, contacts, Wi-Fi passwords, photos (if you used Google's Photos application) and even all the apps you had on your phone so that when you switched to a new phone, it would know which to automatically install again.
When it came to games, Google also eventually brought data syncing for games through the Play Games APIs. However, most apps couldn't back up their data so easily. Starting with Android M, this will change, as developers will be able to automatically backup a user's data for any app.
The data will be backed up automatically (opt-out) in the user's Google Drive account, and it will be encrypted at rest. There will be a limit of 25 MB per app backup, but the total backed-up data won't count against a user's Drive storage quota. When the app reaches that limit, it will stop backing up future data, so developers will need to be careful not to go past that limit.
Developers will be able to exclude what type of data they don't want to be backed up in an XML configuration file in their app. Google also recommends that developers not back up sensitive information such as user credentials or device specific tokens.
The data will be backed up at most once a day and will use the battery life-saving JobScheduler API, which Google introduced in Android Lollipop. The data will be synced at night, when the device is charging, and only when it's connected to Wi-Fi.
To restore data for a certain app, the corresponding app will have to be installed on the device. Users don't have to install the app from the Play Store, as they could also sideload it. For restoring an app's data, all types of network connections will work, including Wi-Fi and 3G or 4G.
Android M Preview was released at Google I/O in May, but the final public version that will also include this auto backup feature won’t be available until later this year. Android M also promises to bring twice as much battery life when the device is idle, and it offers native fingerprint reader support, more granular app permission control and more.