Performing Mobile Business Object Synchronization

To perform mobile business object (MBO) synchronization, you must save a Connection object. Additionally, you may want to set synchronization parameters.

For replication-based synchronization, this code synchronizes an MBO package using a specified connection:

SampleAppDB.Synchronize (string synchronizationGroup) 

For message-based replication, before you can synchronize MBO changes with the server, you must subscribe the mobile application package deployed on server by calling SampleAppDB.subscribe(). This also downloads certain data to devices for those that have default values. You can use the OnImportSuccess method in the defined CallbackHandler to check if data download has been completed.

Then you can call the SubmitPendingOperations(string synchronizationGroup) operation through the publication as this example illustrates:
            Product product_new = new Product();
            product_new.Color="Yellow";
            product_new.Description="";
            product_new.Id=888;
            product_new.Name = "ChildrenPants";
            product_new.Prod_size = "M";
            product_new.Quantity = 200;
            product_new.Unit_price = (decimal)188.00;
            product_new.Create();
            SampleAppDB.SubmitPendingOperations("default");
            while(SampleAppDB.HasPendingOperations())
            {
                System.Console.Write(" . ");
                System.Threading.Thread.Sleep(1000);
            }

You can use a publication mechanism, which allows as many as 32 simultaneous synchronizations. However, performing simultaneous synchronizations on several very large Unwired Server applications can impact server performance, and possibly affect other remote users. The following code samples demonstrate how to simultaneously synchronize multiple MBOs.

For message-based synchronization, synchronize multiple MBOs using:

SampleAppDB.SubmitPendingOperations();
Or you can use:
SampleAppDB.SubmitPendingOperations("my-pub");
where "my-pub" is the synchronization group defined.

For replication-based synchronization, synchronize multiple MBOs using:

SampleAppDB.Synchronize();
You can also use:
SampleAppDB.Synchronize("my-pub");