Getting relative humidity from the phone's humidity sensor

Getting values from the phone's relative humidity sensor is a very similar process to getting values from the temperature or pressure sensors. The only difference is in specifying the sensor type. To get the values from the relative humidity sensor, we have to specify the sensor type as TYPE_RELATIVE_HUMIDITY. All the other standard practices  (initiating SensorManager, the Sensor object, and registering and unregistering the listener and the sensor callback) remain the same. Another point to note is that humidity and relative humidity are used interchangeably; they both refer to the same value.

Time for action - calculating the dew point and absolute humidity

We can use the phone's relative ...

Get Android Sensor Programming By Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.