0

I have user data which is accessed via a REST API which I wish to have periodically synced to allow giving the user notifications and such. I've already implemented an AccountAuthenticator and related classes, but I'm having troubles with creating the SyncAdapter/ContentProvider.

The synced data is basically just a single JSON/POJO object with lots of fields - not a database or anything like that. The ContentProvider method used by every tutorial I found doesn't really fit this as the data isn't laid out like a database at all.

My question is whether using a ContentProvider and attempting to shove the object into a Cursor is the way to go or whether there is a better method.

1 Answers1

0

You do not need to use the content provider to retrieve the data for sync. It is sufficient to use a "stubbed" provider which does nothing. See http://developer.android.com/training/sync-adapters/creating-sync-adapter.html

You can stub out everything except for the method onPerformSync() in your SyncAdapter implementation.

lippertsjan
  • 309
  • 1
  • 18