Many applications that provide function like timely notifications for things like calendar events and incoming chat messages rely on background services that enable users to avail the functionality without keeping the application running in foreground. Extensions for chrome and packaged apps can already display notifications and maintain state without any visible windows, using background pages – a feature available to extension developers. This functionality is now made available to hosted apps – the most common form of apps in the Chrome Web Store – via a new background window mechanism.
Apps and extensions that use the new “background” feature can continue to run in the background—even if the user closes down all of Chrome’s windows. The background apps will continue to run until Chrome exits. The next time Chrome starts up, any background windows that were previously running will also be re-launched. These windows are not going to be visible but they will be able to perform tasks like checking for server-side changes and pre-emptively loading content into local storage.
One way developers can use background windows is to preload content and data so that they are immediately available when the user opens their app. It could also be used to issue HTML5 notifications to alert the user when important events occur. “There are plenty of possibilities here”, says Google in a blog post.
Users can see which background apps (and extensions) are running in their system through the “Background Apps” menu of the Chrome icon in the system tray (Windows/Linux) or dock (Mac). Chrome will automatically load background components when the user logs in, and the Chrome icon will remain in the system tray or dock as long as background apps are running- even if all Chrome windows are closed. To close all background components, a user just needs to exit Chrome.
A developer’s guide and details on the API has been posted along with two very simple sample apps to try out. You should be seeing new Chrome extensions with this feature pretty soon. The feature is already available in Chrome’s Dev channel for some time.