Gears support in the BlackBerry Browser

by Retired on ‎04-21-2010 01:29 PM - edited on ‎01-19-2012 12:14 PM by Retired (2,728 Views)


Gears is no longer supported. This article applies to BlackBerry Smartphone OS 5.0 only.




This article applies to the following:


  • BlackBerry® Web platform
  • BlackBerry® Device Software 5.0
  • Gears™ APIs




Gears is a library of web application programming interfaces (APIs) that provide a browser application with enhanced features and functionality. The Gears library is installed on an operating system, and its functionality can be accessed by the BlackBerry Browser through a JavaScript® interface.


Support for Gears 0.5 was introduced in BlackBerry Device Software 5.0.


A file named gears_init.js is available on the Gears developer web site. This JavaScript file provides the BlackBerry Browser with access to the Gears Factory API, which is part of the BlackBerry Device Software. This API is required to create instances of classes in the Gears API. To use the Gears APIs, you must include a reference to the gears_init.js file.


Some Gears APIs require BlackBerry smartphone users to accept a set of permissions to allow the APIs to perform their function, such as accessing Global Positioning System (GPS) information, also known as geolocation, or storing information in the BlackBerry smartphone memory (Database). BlackBerry smartphone users can manage this information in the Gears Settings section of the BlackBerry Browser options.

The BlackBerry Browser supports the following Gears APIs:

Name Description 
Factory Used to create other Gears objects
Blob A data type for binary data that can be used by web applications. JavaScript does not have a built-in data type for binary data, which restricts how this type of data can be handled. Using Blob objects, binary data can be passed between JavaScript methods.
Database Provides the BlackBerry Browser with offline storage capability that is built on an SQLite® database. This database allows web applications to store data in a persistent location on the BlackBerry smartphone. The BlackBerry Browser can use this information while the BlackBerry smartphone is out of a wireless coverage area, or at a later time when the BlackBerry smartphone user visits the web page again.
Desktop Allows you to dynamically create an icon for your web site on the Home Screen of the BlackBerry smartphone. Clicking on the icon opens the BlackBerry Browser to the specified web address. Because this icon provides an entry point to your web application, you can use the Desktop API as a mechanism to generate return visitors and to increase awareness of your brand.
Geolocation Allows a web application to retrieve GPS location information from the BlackBerry smartphone. This API can provide additional functionality over the existing blackberry.location API if location-based services (LBS) services are available on the BlackBerry smartphone. Currently, only high accuracy position requests are available through the Geolocation API.
HttpRequest Provides functionality that is similar to the XMLHttpRequest object. Unlike the XMLHttpRequest object, the HttpRequest objects can function within the context of a WorkerPool.You can use this API to make dynamic HTTP requests for web resources, such as HTML files or images.
Timer Provides functionality that is similar to the window Timer object. Unlike the window Timer object, the objects of the Gears Timer API can function within the context of a WorkerPool.
WorkerPool Allows JavaScript code that would normally be run synchronously to be run asynchronously. This approach can improve the performance of web applications because the BlackBerry Browser waits until synchronous JavaScript code has completed. Using WorkerPool objects, the BlackBerry Browser can run JavaScript code in parallel with other actions, such as downloading or processing web page content.

Common Questions

Q: What is the difference between Google® Gears and Gears?

A: Google Gears was the initial name for the Gears library. It was later changed to Gears.


Q: Do I need to detect if Gears is installed in the BlackBerry Browser?

A: You should make sure that the BlackBerry smartphone that is accessing the web page is running BlackBerry Device Software 5.0. Because the Gears APIs are included in this version of the BlackBerry Device Software, there is no need to perform an explicit check to see if they exist.


Q: Where does the Database API create the SQLite database that it uses to store my information?

A: The API tries to store database information to the on-board device memory first, and then to an inserted media card.


Q: What type of GPS does the Geolocation API use?

A: Currently only high-accuracy location requests are supported. This API uses the internal GPS of the BlackBerry smartphone.