Guide to Blackberry Location APIs

Page content


This article will help you to understand how to create a BlackBerry application dealing with location APIs.

Most of the current BlackBerry smartphones have an embedded GPS chip which allows the developer to build an application using the phone location. Depending on the phone we are able to use one or another GPS mode. Let’s have a look at them and at the JSR 179 API (and JSR 179 extension that is included in BB 5.0 OS).

GPS modes supported depend on the type and carrier. For the purposes of this article, only GSM devices will be taken into account. GSM based devices support standalone mode. Some carriers have added assisted GPS fixes on their devices with BB Os 4.6 or above.

Let’s have a look to these types:

GPS Modes


This type is supported by all the devices with an internal GPS chip and gets a fix by communicating only with the satellites. This type requires the user to have a clear view of the sky and no data connectivity is required but the radio must be turned on. The time to first fix (TTFF) has a high average so it’s recommended to use this method for those applications which require frequent fixes.


Here it’s the carrier who provides the phone with a fix. It works outdoors and indoors with a partial view of the sky but data connectivity is required. Its TTFF is faster than Standalone mode.

BlackBerry Geolocation Modes (BB 5.0 OS and above)

This is a free service but requires the device to be provisioned with it. Its accuracy is low. Three modes are supported: Cell based (based on cell towers), WLAN based (based on WLAN access points and requires BB 6.0), or based on both Cell and WLAN.

The code

It needs three basic steps:

  1. Setup criteria
  2. Get a LocationProvider
  3. Retrieve Location fixes

1. Setting up criteria

You can choose between the core Location API (JSR 179) or RIM’s location API extension (JSR 179 extensions) to get a Criteria. A criteria defines the GPS mode to be used.


  • JSR-179
    Criteria criteria = new Criteria();
  • JSR-179 extension (since OS 5.0)
    BlackBerryCriteria bbCriteria = new BlackBerryCriteria();


  • JSR-179 Criteria criteria = new Criteria();
  • JSR-179 extension (since OS 5.0) BlackBerryCriteria bbCriteria = new BlackBerryCriteria();


  • JSR-179 (Same as Cellsite Criteria)
    Criteria criteria = new Criteria();

  • JSR-179 extension (since OS 6.0)

  • On GSM, Geolocation is used by default

  • Geolocaiton Optimal BlackBerryCriteria bbCriteria = = new BlackBerryCriteria();

  • Geolocation Cell
    BlackBerryCriteria bbCriteria = = new BlackBerryCriteria();

  • Geolocation WLAN
    BlackBerryCriteria bbCriteria = = new BlackBerryCriteria();

2. Get a LocationProvider

The LocationProvider allows retrieving GPS fixes via its methods.

  • JSR-179

LocationProvider provider = LocationProvider.getInstance(criteria);

  • JSR-179 extension (since OS 5.0)

BlackBerryLocationProvider provider = (BlackBerryLocationProvider)LocationProvider.getInstance(bbCriteria);

  • You must use a BlackBerryCriteria to obtain a BlackBerryLocationProvider

Next article we will deal with Location object and BlackBerry Location object and that way we will cover the whole Location process.