Understanding environmental sensors
Environment-based sensors measure environmental conditions (temperature, humidity, and pressure) around the phone and report values only in one dimension (only one value in the values[]
array). Temperature and humidity sensors have an on-change reporting mode, that is, they will report values whenever there is a change in values from the last reported values, whereas the pressure sensor has a continuous reporting mode; that is, it will report values continuously as per the suggested time interval. Environmental sensors are hardware-based and are only available if a device manufacturer has built them into a device. Because of this, it's particularly important that you verify, at runtime, that an environment sensor exists before you attempt to acquire data from it. Also, unlike motion sensors and position sensors, which often require high-pass or low-pass filtering, environment sensors do not typically require any data filtering or data processing:
- The temperature...