0

我想创建自己的 SyncAdapter,它将我的应用程序中的信息与某个服务器同步。问题是 - 我希望同步本身从我自己的应用程序的上下文中运行,使用我自己与数据库的连接,而无需使用 ContentProvider 访问我的数据库。

那可能吗?

谢谢,

乌迪

4

1 回答 1

4

Short answer: No, it's not possible.

Long answer: The Android platform's model for sync is to link a user Account to a ContentProvider through a SyncAdapter. You can't set up the XML tags in AndroidManifest to be read by the Android platform without having set up all three.

Biased answer: You should never write an app with a local DB. ContentProvider is by far the way to go, for the reasons listed here.

于 2011-05-02T15:58:21.957 回答