Can anyone explain what exactly the Android Backup API is used for?
I have read Using the Backup API and Data Backup from the Developer Docs, but it is still unclear to me.
When is data backed up & restored?
Specifically in these situations:
-
A user installs my app on Device 1, data is backed up, and the user then installs my app on Device 2. Is user data from Device 1 automatically put on Device 2? If so, does this occur when the app is installed or when it is launched?
-
My app is installed on 2 devices. When a change is made on Device 1 is it automatically made on Device 2? If not, is it at least possible to make the change on Device 2?
In one doc, it says
The backup service is not designed for synchronizing application 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 and cannot access it in any way other than through the APIs
provided by the Backup Manager.
But in another,
the Android framework helps you build rich cloud-enabled apps that
sync their data to a remote web service, making sure all your devices
always stay in sync
This seems like a contradiction to me.
More specifically, I want to continually sync a single database file (less than 20 KB) across devices. Is this possible with the Backup API?
Edit: So to answer your question – no, it is not a reliable way to sync your data.
As I see it your app is storing data to the cloud. You push the files to the backup servers and with the API key (that is unique to each users google account) allows you to download the backup to other devices but can only be accesses during the install of the app or by doing a manual request. The documentation states:
As I understand it (without having implemented this my self) you cannot use this as a reliable method for cloud syncing real-time data.
The manifest will probably launch the processing of your data and determine if a backup should be pushed.
Restoring a backup is not manual: