本文介绍了使用Dropbox Datastore API作为Android应用程序的主要存储选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种跨设备同步我的Android应用的SQLite数据的方法.

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

Dropbox数据存储区API似乎非常合适(至少从概念上来说).我已经研究了可用的示例,但尚不了解此API如何适合Android数据访问世界带有ContentProvider => ContentResolver => Adaptor => ListView机制.

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.

我的猜测是,为了更平滑地集成Datastore API,可能需要某些管道,甚至可能是SQLite的直接替代品.而且它所属的最佳位置似乎在ContentProvider附近.

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.

以上假设是否正确,即:我应该尝试编写自定义ContentProvider并将其从Datastore API中获取数据吗?还是存在/计划了更好的选择?

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?

推荐答案

(目前)尚没有直接将Dropbox数据存储区直接连接到SQLite或Android Content Providers的现有基础架构/库.但从概念上讲,我认为您要牢记正确的层次.数据存储区提供与SQLite类似的功能,因此您可以在同一层将其放入您的应用程序中.在Dropbox数据存储区顶部构建的ContentProvider将是抽象细节并使其适合许多现有Android功能的好方法.适应简单查询应该相对简单.

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.

这篇关于使用Dropbox Datastore API作为Android应用程序的主要存储选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 17:58