Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.
Talk:How to use sensors in Java ME
This article discusses the use of the JSR-256 Mobile Sensor API. This API has only recently been available for use on Nokia phones and devices such as the Nokia 5800 and Nokia N97 were among the first to support its use. The API provides access to a wide range of sensors, depending on the implementation of the API and the sensors which each device provides.
The article splits the process of accessing and displaying sensor data into its constituent steps, namely finding the sensor (sensors can be searched for by name), selecting the sensor from the returned list, connecting to the sensor and implementing the dataReceived method. These steps are nicely illustrated using a simple code example. The code example illustrates how to check for a battery level sensor, charger sensor (is the charger plugged in or not) and network intensity sensor. A connection is then opened to these sensors (if found) and the dataReceived method is implemented. The values of the different sensors are then displayed on the screen.
The code example is nicely documented as serves as a useful introduction to the use of the Mobile Sensor API in Java ME.