Talk:How to get information about sensors in Java ME
I'm trying to listen sensors of a Nokia 5800 but this code does not compile. I've downloaded the add-on for the Nokia 5800 and the emulator prototype but nothing. Could be say that it is not possible to access sensors from a J2ME application??
This article discusses the use of the JSR-256 mobile sensor API. The sensor API has been around for a while now, but has only relatively recently been supported by Nokia devices with the release of the Nokia 5800 Express Music (as an add-on) and by the Nokia N97 (no add-on necessary). This article gives a nice clear code example of how to use the Sensor API to access information about the various sensors available on a mobile device.
The code example shows how to discover which sensors are available on the device in question through the SensorManager.findSensors method. The programmer can then use the returned SensorInfo objects to view various descriptive details about the available sensors, including a textual description, the sensor's model and the quantity the sensor in question measures. For each SensorInfo object, the available ChannelInfo objects can then be retrieved in order to view what kinds of information that sensor provides.
Usefully, the output of the code on the Nokia N97 is provided, showing what is returned for the acceleration sensor on this device. Three channels are reported for this sensor, one for each axis of acceleration. Information regarding the unit of measurement and accuracy of these sensor channels are also reported. It is interesting to note that the API does not provide direct access to some of the N97's sensors such as the ambient light sensor and the magnetometer.
the link to "SensorInfoMIDlet.zip" does not download but instead uploading.
Jad and jar files The SensorInfoMIDlet.jad and SensorInfoMIDlet.jar files can be downloaded from SensorInfoMIDlet.zip
I uploaded the real example project because somebody had uploaded trash as SensorInfoMIDlet.zip.