Adding synchronization functionality to an application adds an added level of complexity to your application. The following tips may be useful.
When you are adding synchronization to a prototype application, it can be difficult to see which components are causing problems. When developing a prototype, temporarily hard code INSERT statements in your application to provide data for testing and demonstration purposes. Once your prototype is working correctly, enable synchronization and discard the temporary INSERT statements.
Start with straightforward synchronization techniques. Operations such as a simple upload or download require only one or two scripts. Once those are working correctly, you can introduce more advanced techniques, such as timestamps, primary key pools, and conflict resolution.
In a synchronization system, the primary key is the only way to identify the same row in different databases (remote and consolidated) and the only way to detect conflicts. Therefore, MobiLink applications must adhere to the following rules:
Every table that is to be synchronized must have a primary key.
Never update the values of primary keys.
Primary keys must be unique across all synchronized databases.