I am trying to implement a sync adapter in my app . My app fetch data via REST API , when my app run initially it fetch the data via REST API and set it on my local database . I am now planning to make a sync adapter , by which my app will sync data from server after specific time , After going through several tutorial and documentation provided by android developer it seems that a content provider and account manager/ authenticator is must needed elements for implementing sync adapter . Is it possible to implement sync adapter without these component , only by a class extenting AbstractThreadedSyncAdapter
and a service.

- 3,902
- 6
- 32
- 64
-
afaik you have to provide your custom `ContentProvider` – pskink Sep 19 '15 at 12:55
1 Answers
No. To register a sync adapter in manifest file, you need to provide the content provider details also.
For using sync adapters, you need to have an Authenticator service. When your application account is added to the device accounts list, Sync option can be set on it. When the device sees that the application needs to be synced, first it will check the Authenticator's response. Once authenticator provides authToken, Sync service will use content provider and perform actions in sync adapter.
See : http://blog.udinic.com/2013/07/24/write-your-own-android-sync-adapter and : http://blog.udinic.com/2013/04/24/write-your-own-android-authenticator/
I really found these links useful. I have implemented sync adapter using these links.
If you don't at all want to write a content provider , but need a sync adapter, you can create a content provider, and dont specify any functionality inside. It will just be a dummy provider.

- 1
- 1

- 56
- 1
- 5