ProximitySensor
Definition
A sensor component that can measure the proximity of an object (in cm) relative to the view screen of a device. This sensor is typically used to determine whether a handset is being held up to a persons ear; i.e. lets you determine how far away an object is from a device. Many devices return the absolute distance, in cm, but some return only near and far values. In this case, the sensor usually reports its maximum range value in the far state and a lesser value in the near state. It reports the following value:
- Distance: The distance from the object to the device
Properties
- Available
- Reports whether or not the device has a proximity sensor.
- Distance
- Returns the distance from the object to the device. The sensor must be enabled to return meaningful values.
- Enabled
- If true, the sensor will generate events. Otherwise, no events are generated.
- KeepRunningWhenOnPause
- Returns value of keepRunningWhenOnPause.
- MaximumRange
- Determines a sensor’s maximum range. Some proximity sensors return binary values that represent “near” or “far.” In this case, the sensor usually reports its maximum range value in the far state and a lesser value in the near state. Typically, the far value is a value > 5 cm, but this can vary from sensor to sensor.