Featured classes


This class provides methods that you can use to check if the BlackBerry® device has an accelerometer and to get readings from the accelerometer. To get accelerometer readings, you must first open a Channel to the accelerometer. There are two types of preconfigured channels that the following two methods can open:

  • openOrientationChannel(): This method opens a Channel that returns constants that specify the orientation of the BlackBerry device.
  • openRawDataChannel(): This method opens a Channel that receives data that specifies the orientation of the BlackBerry device along the x, y, and z axes.

This class also provides a method, openChannel(), to open a channel with a specific configuration that the AccelerometerChannelConfig object specifies. You can use this method to open an orientation or raw data Channel to specify whether the Channel should receive accelerometer readings while the application is in foreground mode or background mode. You can also use this method to limit the number of readings that you want to get from the accelerometer. Limiting the context in which the BlackBerry device should receive accelerometer readings is useful in conserving battery life.

The sample application uses the raw data channel exclusively since the trajectory of the image of the rolling ball is affected by the minute changes in the BlackBerry device's relationship with the x, y, and z axes. The sample application also uses the isAccelerometerSupported() method to check if the BlackBerry device that is running the sample application has an accelerometer.


This class provides methods to close a connection to the accelerometer, retrieve data from the accelerometer, check the state of the accelerometer channel (for example, whether it is open or active), and to set or remove an AccelerometerListener object.

The sample application uses this class to retrieve raw data readings from the accelerometer. Because the sample application continuously queries the accelerometer and does not just passively react to changes in the accelerometer, the sample application queries the readings using a loop in a Thread and not through an AccelerometerListener object.

Previous topic: Overview

Was this information helpful? Send us your comments.