Background Sync Service
Component Detail
Service Layer
high complexity
mobile
1
Dependencies
0
Dependents
13
Entities
0
Integrations
Description
Orchestrates automatic synchronization of queued offline mutations and data refreshes when the device regains connectivity. Reads the offline mutation queue from the local SQLite database, batches mutations by entity type, calls the REST API, and marks records as synced or failed. Writes sync progress and unresolvable conflicts to a status table that the foreground app reads on next launch to display user-facing messages.
background-sync-service
Responsibilities
- Read pending mutations from offline queue and batch by entity type
- Execute batched API calls to upload pending changes to backend
- Download fresh data from backend and update local database
- Track sync progress and write status for foreground consumption
- Detect and surface unresolvable data conflicts to the notification system
Interfaces
executeSyncCycle()
uploadPendingMutations(batch: MutationBatch)
downloadFreshData(entityTypes: List<String>)
getSyncStatus(): SyncStatus
getConflicts(): List<SyncConflict>
markRecordSynced(recordId: String)
markRecordFailed(recordId: String, reason: String)
isSyncInProgress(): bool
cancelSync()
Relationships
Related Data Entities (13)
Data entities managed by this component
Activity
26 fields
core
Contact
22 fields
core
Expense
23 fields
core
Note
16 fields
core
Activities
24 fields
core
Contacts
24 fields
core
Event Registrations
14 fields
core
Events
27 fields
core
Expense Receipts
22 fields
core
Expenses
31 fields
core
FAQ Items
14 fields
configuration
Notes
11 fields
core
Notifications
24 fields
core