简体   繁体   English

是否可以更改Android接近传感器的最大范围?

[英]Is it possible to change the maximum range on the Android proximity sensor?

Can I use the proximity sensor to detect something further than the maximum range returned by sensor.getMaximumRange()? 我可以使用接近传感器来检测比sensor.getMaximumRange()返回的最大范围更远的东西吗? Something like 50cm instead of the 8cm I'm getting now? 我现在得到的是50厘米而不是8厘米?

I don't think so. 我不这么认为。 Usually the proximity sensor give back 0 or max range because this is usually used to turn the screen off when you call and your head is near the phone. 通常,接近传感器会返回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. 在这种情况下,传感器应在远处报告其最大范围值,在近处报告较小的值。

After it really depends of the hardware of the phone but I doubt that you can outranged the maxRange value. 之后,它实际上取决于电话的硬件,但是我怀疑您是否可以超出maxRange值。 You can still take a look on aosp about the sensor stack but the native fragment is close to what android.hardware is. 您仍然可以在aosp查看有关传感器堆栈的信息,但是本机片段接近android.hardware

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM