Search code examples
androidandroid-syncadapter

Custom SyncAdapter without using ContentProvider


I want to create my own SyncAdapter, that syncs information from my app with some server. The thing is - I want the sync itself to run from my own application's context, using my own connection to the DB, w/o the need to access my DB using a ContentProvider.

Is that possible?

Thank you,

Udi


Solution

  • 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.