answered
2014-05-19 08:54:38 +0200
The synchronization code is somewhat complex.
You can see most of the implementation at https://github.com/nemomobile/qtcontacts-sqlite/blob/master/src/extensions/twowaycontactsyncadapter_impl.h but note that there is some Google-specific extensions to this code which is used in the actual sync adapter (that code will hopefully be opensourced in the near future).
Basically, when a sync occurs the algorithm is:
1) determine what changes occurred remotely since the last sync (or compared to the sync baseline)
2) apply those changes to the contact in the local database
3) determine what changes occurred locally since the last sync
4) push those changes up to the server.
If a contact is updated on the phone, the changes will be propagated to the server. If a contact has been updated on the server, the changes will be propagated to the phone database. If the same contact is modified on both, the deltas will be inspected and the appropriate changes applied to both. In the case where the same detail is modified both remotely and locally, we currently prefer the local device changes for that detail (this conflict resolution policy is something we're hoping to expose as a setting in the future, however).
Cheers,
Chris.