Reading Raw Sensor Data


Build your own Android App Dev Empire

Get Instant Access

The following are some of the device sensors that the Android SDK supports:

► Accelerometer—Measures acceleration in three dimensions

► Light sensor—Measures brightness (which is useful for camera flashes)

► Magnetic field sensor—Measures magnetism in three dimensions

► Orientation sensor—Measures a device's orientation

► Temperature sensor—Measures temperature

► Proximity sensor—Measures the distance from the device to a point in space

The Android emulator does not simulate any device sensors natively, but OpenIntents provides a handy sensor simulator ( 23). This tool simulates accelerometer, compass, and orientation sensors, as well as a temperature sensor, and it transmits data to the emulator. You can also test sensor functionality on the target device.

The SensorManager object is used to gather data from the device sensors. You can retrieve an instance of SensorManager by using the getSystemService() method.

Was this article helpful?

0 0

Post a comment