RNJ
RNJ

Reputation: 15552

backing up my local database/data

I am very new to android and am trying to understand db persistence.

Consider this scenario

The problem I think I may have what happens if there is no remote connection. Then this could happen

There are various scenarios where I think this pattern will cause conflicts between devices. Am I missing a simpler better way to store and sync data between multiple devices. Perhaps just only store things on a remote databse perhaps.

As i said I am new to this so any advice would be greatly received.

Thanks

Upvotes: 1

Views: 345

Answers (1)

Anup Cowkur
Anup Cowkur

Reputation: 20553

From the docs:

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.

The backup agent is not meant to be used in the way you are using it. It is not meant to provide real-time syncing of data between multiple client devices. It is only designed to backup stuff such as user preferences so that if users move to a new device or reset their phones, they can restore their settings and things like that .

When you request a backup, the agent does not do it immediately. It does it at a later time based on a number of different parameters (such as network efficiency). It is generally meant to store the latest version of a users preferences.

If you want real-time syncing between devices, you would need to implement your own backend or try out one of the BAAS (Backend-As-A-Service) providers such as Parse or Firebase.

Upvotes: 2

Related Questions