About Sync Statuses

To enable full control over “in-flight” sync operations, Mobile SDK 7.1 adds a new status that indicates that the operation has been stopped.

Before Mobile SDK 7.1, each sync operation progressed through a cycle of statuses: new, running, and either failed or done. Mobile SDK 7.1 adds a stopped status to the final step, changing the cycle as follows:

  1. new
  2. running
  3. stopped | failed | done

When key events occur, sync statuses are updated as follows.

EventPrevious StatusReported Status
App creates a sync objectnew
Sync object is submitted for running by a call to a sync down or sync up method, or by a first call to reSyncnewrunning
Sync operation completes successfullyrunningdone
Sync operation fails to completerunningfailed
A sync manager stop request is detectedrunningstopped
Sync manager restarts with the restartStoppedSyncs parameter set to truestoppedrunning
reSync is calledstopped/failed/donerunning

Flow chart showing how sync status changes at key events

  • Any call to a reSync method on a currently running sync operation fails.
  • Any call to a reSync, syncDown, syncUp, or cleanResyncGhosts method fails if the sync manager state is not in the accepting_syncs state.
  • If any sync operations are running when the sync manager is first initialized—for example, if the app recently crashed shortly after starting syncs—the sync manager sets their statuses to stopped.

Beginning with Mobile SDK 7.1, sync manager objects support a getSyncsWithStatus method that returns all sync state objects whose status matches a given value. You can use this method, for example, to iterate through all stopped syncs and restart them manually.

To assume manual restart control over stopped syncs, call the sync manager’s restart method with restartStoppedSyncs set to false.




Android (Java)