Synchronize SQLite Database and Dropbox Data Warehouse

I am developing an Android application for Android. The application stores data in a SQLite database. I want to implement additional backup / synchronization for application data using the Dropbox datastore API . If the user has linked their Dropbox account, the application data must be stored in the Dropbox cloud and synchronized between all user devices.

My solution initially stores all the application data in a database. When a user has linked their Dropbox account application, all data will be transferred to the data warehouse. After that, the application will work with the data warehouse (since it supports offline caching and performs synchronization in the background). If a user decides to cancel his Dropbox account from the application, all his data will be transferred back to the local SQLite database on the device. I want to create an interface for storing application data and have two implementations: SQLite database and Dropbox data warehouse. Thus, other components of the application will not be dependent on the implementation of the repository. And, of course, all this will be completely transparent to the user.

Is this a good approach? Can you suggest a better way?

Thanks in advance!

+4
source share
2 answers

Finally, I implemented this. Sources can be found here . The key class is the Dropbox storage implementation . The application uses a data storage interface and works great with both implementations (database and Dropbox data storage). Both implementations cache the results of frequent queries. The only thing that bothers me is performance. I have not yet tested or compared the performance of data requests and content change requests for these implementations. But I would say that the application runs smoothly, and I did not notice any delays.

+1
source
+3

Source: https://habr.com/ru/post/1535372/


All Articles