There are two ways you can do this. You can use the Sensor class and SensorListener API that were added in version 4.6.0 of the BlackBerry API set. Or you can use the Holserlistener, which has been deprecated but is available in older versions of the BlackBerry API set.
Mark Sohm BlackBerry Development Advisor
Please refrain from posting new questions in solved threads. Problem solved? Click the Accept As Solution button. Found a bug? Report it using Issue Tracker