I did investigate? • I work on an SDK similar to firebase • Should work offline • Should have a simple API • Should be reliable and user friendly Why This matters?
Sync Adapters Why I did investigate? • Offline improves user experience • No loading times (most of the cases) • App always accesible • Just like magic • Makes your app less error prone • Forces the developer to think more mobile • Say no to: “you always have a good internet connection”
Sync Adapters Why I did investigate? Using POJOS • Action cancellation • Lifecycle management • Single responsibility principle broken • Messy thread management • Hard to read code • Fast to implement
Sync Adapters Why I did investigate? Views/MVP/ Interactors Using Services Service ResultReceiver/Binder Threading Database Sync Network Sync Pojo Callback
Sync Adapters Why I did investigate? Problems using Services • Action cancellation is still a pain • Easy to leak memory • Easy to split in many services • Export to other apps • Easier to handle threading • Possibility to have many processes • Simplified callback system
Sync Adapters Why I did investigate? Problems using Services • Hard disconnection errors • Sync adapter documentation • Sync adapter configuration (many files) • Too linked to accounts • Uses system tools • Content change notifications • All the benefits from services
Loaders Repositories Started Stopped Reset Can load Can observe Can deliver Can load Can observe Can deliver Can load Can observe Can deliver Stop/Reset Start/Reset Start
Write Repositories Data Repository Notifies Asks for data Loader Inits Provides data System Scheduler Schedule sync Sync Service Sync task Conditions met Run task Changes data Read Write Read Write Views/ MVP/ Interactors Start App SDK write