Work Offline With Google Gears

There are two distinct genres of applications that we use: online and offline. Historically, software packages were supposed to run off the hard-disk after running an installation or setup programme. Then came the web and offered sites like Hotmail allowing users to substitute mail programmes with an online alternative.

Since then, the race to port traditionally desktop managed applications to online browser-based versions has taken unprecedented pace. Now everything from e-mails, spreadsheets, word processors, presentations and even corporate tools like CRMs, ERPs, help desks, project management tools, all are available as online applications. But there is one limitations in these applications: they can only be used till home user is connected with the internet.

This limitation has obstructed wide-spread use of online office suites against the MS Office, since users in our country can neither afford to have an always on connectivity, nor the infrastructure allows it. So, to bridge this gap between online and offline functionality, Google has come up with a new technology called Google Gears that web enthusiasts term as truly revolutionary and groundbreaking.

Google Gears, allows existing web-based applications to support offline mode. One of the exciting examples of this technology is Google Reader, an online RSS news feed reader which can now download the feeds for offline viewing right in the browser interface - without having to download or install any specific programme.

Not only Google's own applications, but third-party solution providers such as, Zoho's web based word processor called Zoho Wirter offers the work offline facility. What this means is that, even though a user is using a browser-based application while connected to the internet, the programme will not cease to function when the connectivity is no longer there. Imagine having access to Gmail while offline, so that e-mails can be composed and sent when going online again.

Though a far fetched thought at this point in time, but it could very well be the ultimate goal of technologies like Google Gears. Because this is the only way for web application developers to pose a threat to the long standing dominance of desktop software giants such as Microsoft.

Google Gears claims three distinct functions: Store and serve application resources locally, store data locally in a fully-searchable relational database and use of javascript to improve application responsiveness to make them look much more like high performance desktop application.

To get started with Google Gears, download it as a browser plug-in for either Internet Explorer or Firefox. As it supports all the major OS like Windows, Mac and Linux, trying it out should not be a problem.

Once installed, applications designed to take advantage of offline functionality automatically start to work seamlessly - except for two most common visual notifications. First is a link saying Go Offline - for example, Google Reader and Zoho Writer. Say you are using Zoho Writer in browser window, pressing Go Offline results in second indication - a dialogue box asking for permission to use Google Gears. This is extremely important from security point of view since giving an application authority to store data locally can cause havoc if in hands of malicious developers. So be sure whenever you press Allow. To control allowed and denied sites in Firefox, go to Tools > Google Gears Settings.

Back to the discussion. Once in offline mode, and the internet is disconnected, you may continue to work on your document, and use a variety of formatting and other options. Pressing Go Online after connectivity is restored results in data synchronisation. Note that in applications such as Google Reader, going online again would mean updating new feeds from the server to the client display, but there is nothing much to send back to server in terms of user generated data. Reader can at most mark starts or change status from unread to read.

As an end-user, all we can do is to wait and see when online application companies make their products Google Gears enabled. But as a developer, you can start migrating your own website to take advantage of Gears. There is a full-fledged Developer's Guide available over Gear's official site along with Getting Started, that is

  • TutorialArchitecture
  • Security plus Resources and Tools.

The API reference is a rich source to see hands-on code examples for factory, database, Local Server and Worker Pool management in Google Gears. Note that Google Gear is not a language in itself - it is an extension of existing web architecture that would now support offline mode, and for that it uses JavaScript. While adding offline connectivity support to your existing web application, keeping in mind the following factors:

1. Data Layer and Synchronisation

Normally, a web-browser would talk directly to the web-server to fetch and update information shown to the user. Introduction of a data store between client (that is, browser) and server would mean that the client would make all its queries and requests to this data store instead of server which in turn would interact with the server. Or additionally, a data switch can be introduced between the client and data store and it is left up to this switch to decide when to fetch the data from the server, or when to refresh the server as new information is available (for example, user updates a document and auto-save has to be performed while online or offline).

This is how AJAX works, as data synchronisation with the server is no more necessary on every form submit or button press event as in the traditional web. And that is the power of Google Gears using which Remember The Milk, an online task management application, incorporated offline support in its service. Also, its important to decide ‘modality' that is, if there is going to be a user clicked go-offline function or the app would automatically detect disconnection an go-offline transparently, or a combination of both.

2. User of LocalServer, Database and WorkerPool

Depending upon the nature of application or website, the above three components of Google Gear can be used to create a rich user experience. LocalServer allows content to be kept at client side to speed things up, say by downloading and storing style-sheet CSS files. These are version controlled and updates are automatically updated. For data intensive sites, Gears data store in SQLite 3 format so that applications such as task managers and bookmarking sites can easily store, organise and retrieve customer data. Finally, WorkerPool can be used to introduce threading like capability to an application.

3. Offline Features

A lot depends upon nature of an application itself before deciding which features are to made available in offline mode. For example, downloading a customer's online bookmarks for local editing in bulk makes sense as compared to presenting the data in browser and requiring the user to press Submit every now and then. Similarly, processing-intensive search functionalities can be pushed at client side. That is why there should be a thorough analysis of all these architectural considerations for designing a new offline-supported app or adding this functionality in an already developed application.

The line separating online and offline state continues to get blurred and Google Gears is a giant step in this direction.

More by this Author


Comments 3 comments

Neil Ashworth profile image

Neil Ashworth 6 years ago from Ireland

Beautiful !!! Love it..


Neil Ashworth profile image

Neil Ashworth 6 years ago from Ireland

Cool hub!!!


chinemeremz profile image

chinemeremz 5 years ago

The big G keeps improving lives every day with their never ending wonderful apps. Thanks for this well thought out and written hub, really enjoyed it. Got it bookmarked already.

    Sign in or sign up and post using a HubPages Network account.

    0 of 8192 characters used
    Post Comment

    No HTML is allowed in comments, but URLs will be hyperlinked. Comments are not for promoting your articles or other sites.


    Click to Rate This Article
    working