Extends the JSR-179 Location API to support Bluetooth GPS devices and improve consistency across vendor implementations. This API helps in the following use cases:
  1. Most devices do not have JSR-179 available. Building against that code normally would result in class not found errors and prevent the application from running. This implementation handles that so if you write against it and the device does not have JSR-179 your application will still run.
  2. To get location information on phones that do not have JSR-179 the only way is communicating to a separate Bluetooth GPS device. This API supports that by providing the Bluetooth address to the Criteria object. The API also supports dynamic discovery of nearby Bluetooth devices (within 10 meters) to get that address.
  3. JSR-179 implementations vary between vendors making code that runs on one device fail on another. For example BlackBerry phones raise location events on their main UI thread so taking too long to process them can result in your application crashing. The J4ME implementation obscures these problems and gives a consistent implementation so you can truly write once and run anywhere.
  4. Location information available on most devices is based on cell tower triangulation which costs money to use and is only accurate to about 60 meters. To get free and/or more readings within 1 meter you need to use Bluetooth GPS.

Not all of JSR-179 has been implemented. There are some missing classes but they are simple to add if you need them (and remember to contribute your work back!). Specifically the landmark store, proximity listener, a few other methods are not complete. None of those require GPS knowledge to implement.

Recommended Bluetooth GPS

Bluetooth GPS pucks are all fairly similar. There are slight variations in chipsets but the main differentiators are price, battery life, and packaging. We have tried a dozen of these over the past year and as of this writing (Nov 21, 2007) our recommendation is the OnCourse Edition 3 which costs $50 and is about the size of matchbox. You can purchase it through the link on the right (it comes with a car charger but not a wall charger; if you do not have a mini-USB charger a cheap one that works with it is listed alongside).

Porting

Porting code written against the Location API (JSR-179) to J4ME is very simple. Search for "javax.microedition.location" and replace with "org.j4me.bluetoothgps".

That will insulate you from JSR-179 implementation variations but it will not be able to connect to Bluetooth GPS devices. For that you must call Criteria.setRemoteDeviceAddress(address) where address is the Bluetooth GPS puck's address. See the example for more information including how to get the Bluetooth address.

Example

An example is provided in the /examples folder under the org.j4me.examples.bluetoothgps package. It is a simple pedometer application that also outputs the various location data as it is received.

The example illustrates how to:

Related Documentation