Building an Object API based Client Application

This example illustrates the basic code requirements for connecting to Unwired Server, updating mobile business object (MBO) data, and synchronizing the device application from a Client Object API based device application.

  1. Log in to Unwired Server using a user name and password:
    <PkgName>DB.loginToSync("supAdmin", "s3pAdmin"); 
  2. Synchronize MBOs by group name synchronization:
    <PkgName>DB.synchronize(“default”);
  3. Retrieve MBO data:
    ObjectList customers = Customer.findAll();
    int size = customers.count();
    for (int i = 0; i < size; i++)
    {
    	Customer cust = (Customer)customers.elementAt(i);
    	//Feed the MBO data to your view…
    }
    
  4. Update MBO data:
    Customer cust = Customer.findByPrimaryKey(100);
    cust.setAddress(“1 Sybase Dr.”);
    cust.setPhone(“9252360000”);
    cust.save();//or cust.update();
    
  5. Submit pending operations and synchronize again:
    Customer.submitPendingOperations();
    <PkgName>DB.synchronize(“default”);