This is how I perform a sync now:
* get preference "timestamp" and save to variable TIMESTAMP
* save current time to preference "timestamp" (2)
* query server side items with update time bigger than TIMESTAMP
* for each item
* compare with local item's per item update_time
* if server side is newer
* update local
* else if local is newer
* set item update time to now (1)
* upload
* save back
* else if equal
* do nothing
*
The question is, when I sync next time, the last time synced items will appear in the "do nothing" section, but my app is a mobile app, so there is a large data waste.
I thought about set the items's update time to TIMESTAMP
, but I think there are situations that two client is syncing the same time, and there are chance of out sync, because the item's real uploaded time is not what in it's update time field, and if one client checked the server between the two time, this item is missed.
I'm using Google Tasks API, I cannot change the implement of the server side.
Any suggestions?