Google Gears is Googles latest undertaking for using applications off line. But as with any new offering from any software company, there are going to be a few hitches in the get along. I stumbled on one such situation but was able to find the answer on Googles site in which they explain how to get around the synchronization problem that some apps. may pose. This is what Google has to say:

No matter which connection and modality strategy you use, the data in the local database will get out of sync with the server data. For example, local data and server data get out of sync when:

  • The user makes changes while offline
  • Data is shared and can be changed by external parties
  • Data comes from an external source, such as a feed

Resolving these differences so that the two stores are the same is called “synchronization”. There are many approaches to synchronization and none are perfect for all situations. The solution you ultimately choose will likely be highly customized to your particular application.

Below are some general synchronization strategies.

Manual Sync

The simplest solution to synchronization is what we call “manual sync”. It’s manual because the user decides when to synchronize. It can be implemented simply by uploading all the old local data to the server, and then downloading a fresh copy from the server before going offline.

Manual sync requires that:

  • The amount of data is small enough to download in a reasonable amount of time.
  • The user explicitly indicates when he or she is going offline, typically via a button in the user interface.

The problems with this method and with the offline mode it creates, are:

  • Users don’t always know the state of their network connections. Internet connections may die unexpectedly or be intermittent, for example, on a bus.
  • Users may forget to synchronize before going offline.

Manual sync can be a good way to get started as it is relatively easy to implement. However, it requires the user to have awareness and involvement in the synching process.

Background Sync

In a “background sync”, the application continuously synchronizes the data between the local data store and the server. This can be implemented by pinging the server every once in a while or better yet, letting the server push or stream data to the client (this is called Comet in the Ajax lingo).

The benefits of background synching are:

  • Data is ready at all times, whenever the user chooses to go offline, or is accidentally disconnected.
  • The performance is enhanced when using a slow Internet connection.

The downside is that the sync engine might consume resources or slow down the online experience with its background processing (if it’s not using the WorkerPool). Using WorkerPool the cost of synching is minimized and no longer affects the user’s experience.

Additional information can be found at Googles website here. I am personally hoping that may, just may, this synchronization problem will be solved before the final release. I recall having to sync a mini laptop with my desktop using Microsoft’s app. and it was always a challenge. Hopefully this will not be the case for Google. Only time will tell how this works out.

Comments welcome.

[tags]google, sync, apps, google gears, problem, [/tags]