0

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

Udinic
  • 3,014
  • 2
  • 25
  • 32

1 Answers1

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.

Community
  • 1
  • 1
jcwenger
  • 11,383
  • 1
  • 53
  • 65
  • Hi, i have written a google task syncing part in async task. But if my app moves to background, thread halts by itself. So to overcome this i'm planning to implement sync adapter. I'm no where using content provider in my app, only Direct DB calls i'm doing. Is it possible to move my sync code to syncadapter and make it work?. My DB requires context to establish connection. If the app is not running in background how it establish connection? – Naruto Jun 26 '14 at 04:29
  • 1
    @Naruto, try starting with http://stackoverflow.com/questions/5253858/why-does-contentresolver-requestsync-not-trigger-a-sync/5255360#5255360 – jcwenger Aug 13 '14 at 19:32