Using Dropbox Datastore API as a primary storage option for Android application

廉价感情. 提交于 2019-12-23 10:39:38

问题


I'm looking for a way to sync SQLite data of my Android app across devices.

Dropbox Datastore API seems to fit just fine (at least conceptually). I've studied available examples, but cannot yet understand how does this API fit into Android data access worldview with it's ContentProvider=>ContentResolver=>Adaptor=>ListView machinery.

My guess is that certain plumbing is required for smoother integration of Datastore API, maybe even as a drop-in replacement of SQLite. And the best place where it belongs seems to be close to ContentProvider.

Is the above assumption correct, i.e.: should i try to write my custom ContentProvider that will take it's data from Datastore API? Or maybe better options exist/planned?


回答1:


There isn't (yet) an existing infrastructure/library for directly connecting Dropbox Datastores to SQLite or Android Content Providers. But conceptually, I think you have the right layering in mind. A Datastore provides a similar sort of functionality to SQLite, so you can fit it into your application at the same layer. A ContentProvider built on top of a Dropbox Datastore would be a good way to abstract away the details and fit in with a lot of existing Android functionality. It should be relatively straightforward to adapt for simple queries.



来源:https://stackoverflow.com/questions/17725422/using-dropbox-datastore-api-as-a-primary-storage-option-for-android-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!