Users often invest significant time and effort creating data and setting preferences within apps. Preserving that data for users if they replace a broken device or upgrade to a new one is an important part of ensuring a great user experience. This section covers techniques for backing up data to the cloud so that users can restore their data.
Android provides two ways for apps to backup their data to the cloud: Auto Backup for Apps and Key/Value Backup. Auto Backup, which is available starting API 23, preserves app data by uploading it to the user’s Google Drive account. The Key/Value Backup feature (formerly known as the Backup API and the Android Backup Service) preserves app data by uploading it to the Android Backup Service.
Generally, we recommend Auto Backup because it requires no work to implement. Apps that target Android 6.0 (API level 23) or higher are automatically enabled for Auto Backup. The Auto Backup feature does have some limitations in terms of what data it can backup and it's availability on Android 6.0 and higher devices. Consider using the Key/Value Backup feature if you have more specific needs for backing up your app data. For more information, see Comparison of Key/Value and Auto Backup
Note: These data backup features are not designed for synchronizing app data with other clients or saving data that you'd like to access during the normal application lifecycle. You cannot read or write backup data on demand. For synchronizing app data, see Transferring Data Using Sync Adapters or Google Drive Android API.