总结:距离感应器单位是cm,每个距离感应器可能都不一样,大部分都只有远近两种结果,getMaximumRange() 可以得到远近的分界值。
参考:
TYPE_PROXIMITYSensorEvent.values[0] cm
Sensor.TYPE_PROXIMITY
:
values[0]: Proximity sensor distance measured in centimeters
values[0]:距离感应器测量单位是厘米。
Note: Some proximity sensors only support a binary near or far measurement. In this case, the sensor should report its maximum range
value in the far state and a lesser value in the near state.
注意:很多距离感应值只支持一个二进制 近和远的尺寸。这种情况,感应器要汇报出它的 maximum range
值在远处和小的值在近处.
public float getMaximumRange ()
Returns
- maximum range of the sensor in the sensor's unit.
- 感应器最大的范围。