A synchronization group is a group of related MBOs. A mobile application can have predefined synchronization groups. An implicit default synchronization group includes all the MBOs that are not in any other synchronization group.
This code synchronizes an MBO package using a specified connection:
SMP101DB.synchronize (string synchronizationGroup)
The package database class includes two synchronization methods. You can synchronize a specified group of MBOs using the synchronization group name:
SMP101DB.synchronize("my-sync-group");
Or, you can synchronize all synchronization groups:
SMP101DB.synchronize();
There is a default synchronization group within every package. The default synchronization group includes all MBOs except those already included by other synchronization groups. To synchronize a default synchronization group call: SMP101DB.beginSynchronize("default"); or SMP101DB.synchronize("default");
If there is no other synchronization group, call SMP101DB.beginSynchronize(); or SMP101DB.synchronize();
GenericList<SynchronizationGroup> syncGroups = new GenericList<SynchronizationGroup>(); syncGroups.add(SMP101DB.getSynchronizationGroup("my-sync-group")); SMP101DB.beginSynchronize(syncGroups, "");
if (!SMP101DB.isReplayQueueEmpty()) { // There are OperationReplay not uploaded to server GenericList<SynchronizationGroup> sgs = new GenericList<SynchronizationGroup>(); sgs.add(SMP101DB.getSynchronizationGroup("system")); SMP101DB.beginSynchronize(sgs, "upload OperationReplay objects"); }