An Introduction to Backup Manager
Most of the application that are installed on current android devices have a good amount of data associated with it. Whenever someone migrates from one device to another, they end up having to transfer all their data across to the new device. For a non technical person this can be a pretty tricky and frustrating, not to mention time consuming thing to do. What if the app would some how automatically transfer all the data across to the new device without the user needing to do anything. Thats exactly what backup manager allows to do .
What is Backup Manager?
BackUp Manager is a component introduced in Android 2.2 to allow applications to backup persistent data to a Cloud Backup Service. The Backup Manager handles all your data transactions with the cloud storage using the backup transport. The developer will have to create a backup agent that handles all the data transactions on the device.
Why we need it ?
The idea is to provide one single component to all the applications to provide data back up feature instead of making every app have their own data backup component and logic behind it. Having a centralized component for this makes it easy to not only schedule back ups from an operating system perspective but offloads from the developer to need to develop a back up service per application.
- Application would call the Custom Backup Agent class which is extended from BackupAgent or BackupAgentHelper class provided by android.
- Backup agent is responsible for all the data transactions on the device . It communicates with the available backup transport.
- Backup Transport would schedule the backup accordingly and handle all the data communication with the cloud service.
- Better end user experience while migrating from one device to another. eg) user preference files
- Offload backup responsibility to the OS .
- Unified mechanism to communicate to google backup cloud service for all applications on the device .
- Can have logical restore points for application data.
- Less error prone to implement.
Things to keep in mind
The Backup manager uses the backup transport to send/receive the data form the cloud back up service.Backup transport is a client side component provided by android framework. Device manufactures are free to have have their implementation of the backup transport that talks to a custom cloud service. It is transparent to the application which backup transport is being used.
Since different devices can have different backup transports and cloud service for backup security is a concern and it is advised not to back up any sensitive information using this service.
Backup service is not guaranteed to be available in all android devices. So do not tie your application logic to If it is not available the application will continue to perform the same way except for the fact that there will not be any backups created.
This mechanism is not designed to put and retrieve data on demand and hence should not be used for syncing application data. For syncing data we should use Android Data Sync service which I’ll explain in another post.