| Scott Main | beb0889 | 2012-12-03 20:31:35 -0800 | [diff] [blame] | 1 | page.title=Android Backup Service |
| 2 | @jd:body |
| 3 | |
| 4 | |
| 5 | <p>Android Backup Service provides a <em>backup transport</em> for Android's <a |
| 6 | href="{@docRoot}guide/topics/data/backup.html">data backup</a> framework, which allows you |
| 7 | to copy a user's persistent app data to remote "cloud" storage. Backing up persistent data |
| 8 | this way provides a restore point for the app on most devices running Android 2.2 or |
| 9 | higher. The backup service is <em>not</em> designed for synchronizing application data with other |
| 10 | clients or saving data that you'd like to access at random during the |
| 11 | application lifecycle.</p> |
| 12 | |
| 13 | <p>The Android Backup Service offered by Google provides a backup |
| 14 | transport on most devices that include Google Play Store and backs up your app data to Google |
| 15 | servers. The backup transport may differ |
| 16 | from device to device and which backup transport is available on any device is |
| 17 | transparent to your application.</p> |
| 18 | |
| 19 | <p>In order to use Android Backup Service, you must <a href="{@docRoot}google/backup/signup.html" |
| 20 | >register your app</a> with the service to receive a key that you must |
| 21 | include in your Android manifest.</p> |
| 22 | |
| 23 | <p class="note"><strong>Note:</strong> Registering your application with Android Backup |
| 24 | Service does not guarantee that it will always back up data using this service |
| 25 | from Google. If you support |
| 26 | data backup in your application, then it will back up using whichever transport is enabled |
| 27 | on the device. Registering with Android Backup Service allows your application to back up |
| 28 | when the backup transport on the device is provided by Android Backup Service.</p> |
| 29 | |
| 30 | <p>For more information about how data backup works on Android and how to use it in your app, |
| 31 | read the <a href="{@docRoot}guide/topics/data/backup.html">Data Backup</a> guide.</p> |
| 32 | |
| 33 | |
| 34 | |
| 35 | <h2>Adding the Backup Service Key to the Manifest</h2> |
| 36 | |
| 37 | <p>Once you <a href="{@docRoot}google/backup/signup.html" |
| 38 | >register your app</a>, you'll receive a Backup Service Key, |
| 39 | which you must include in your Android manifest file with the following syntax:</p> |
| 40 | |
| 41 | <pre class="prettyprint"> |
| 42 | <application> |
| 43 | <meta-data android:name="com.google.android.backup.api_key" |
| 44 | android:value="<em>your_backup_service_key</em>" /> |
| 45 | ... |
| 46 | </application> |
| 47 | </pre> |
| 48 | |
| 49 | <p>Insert your Backup Service Key in the <code>android:value</code> attribute and place the |
| 50 | <code><meta-data></code> element inside your Android manifest's |
| 51 | <code><application></code> element.</p> |
| 52 | |
| 53 | <p>When a device that uses Android Backup Service runs your application, |
| 54 | the system verifies that your Backup Service Key is valid and Android Backup Service saves the |
| 55 | user's data to Google servers using the primary Google account on the device.</p> |
| 56 | |
| 57 | <p>If your application |
| 58 | does not provide a valid Backup Service Key, then backup will not occur. If the device does not |
| 59 | provide backup using Android Backup Service, then the <code><meta-data></code> element and |
| 60 | Backup Service Key are ignored—your application will work normally, but will either back up |
| 61 | data using a different backup transport or not perform backup at all. Either |
| 62 | way, your application is unaware of what transport is used, if at all, and otherwise |
| 63 | operates normally.</p> |
| 64 | |
| 65 | <p>For more information about how to provide data backup in your Android application, see the <a |
| 66 | href="{@docRoot}guide/topics/data/backup.html">Data Backup</a> guide.</p> |
| 67 | |
| 68 | |
| 69 | <h2>User Privacy</h2> |
| 70 | |
| 71 | <p>At Google, we are keenly aware of the trust users place in us and our responsibility to protect |
| 72 | users' privacy. Google securely transmits backup data to and from Google servers in order to provide |
| 73 | backup and restore features. Google treats this data as personal information in accordance with |
| 74 | Google's <a href="http://www.google.com/privacypolicy.html">Privacy Policy</a>.</p> |
| 75 | |
| 76 | <p>In addition, users can disable data backup functionality through the Android |
| 77 | system's privacy settings. When a user disables backup, Android Backup Service deletes all saved |
| 78 | backup data. A user can re-enable backup on the device, but Android Backup Service will not restore |
| 79 | any previously deleted data.</p> |