whizzle
whizzle

Reputation: 2063

Multiple Sync adapters in a single app or just 1

This question is more theoretical. Let's say I have an app that is social media-ish. This app needs to sync offline data which consists of 3 main and fairly separate areas: notifications, user profile, and say calendar data. I could have 3 separate sync adapters for each of these or I could have 1 main sync adapter using a composite pattern which calls the 3 other composed sync adapters. As it stands now, a user will not see the "sync" in the Settings->Account as the visibility will be turned off, but who knows requirements always change. I see benefits to both approach. I'm looking to hear outside opinions which will cause me to think more about the scenario.

Upvotes: 2

Views: 1804

Answers (1)

Sean
Sean

Reputation: 7670

If you want to control the synchronization of each source independently you should create 3 separate SyncAdapters. If it's acceptable to coordinate the sync of all 3 sources at once, a single sync adapter would be ideal.

It would be ideal to abstract the sync implementation such that it could be used/shared for each sync source implementation.

Such an abstraction can be found in this library: https://github.com/sschendel/SyncManagerAndroid

Upvotes: 1

Related Questions