开发者

Android Phones with enhanced proximity sensor

I currently use the proximity sensor of an HTC Wildfire phone. The problem is that it only returns a boolean value if there is an object within 1 cm in front of the sensor.

So, I want to ask if there开发者_如何学JAVA is an Android phone available in the market that has a proximity sensor which is able to return actual distance values (cm) instead of a boolean..

Thank you


Yes it is possible to obtain actual distance from the phone surface.

In fact ALL hardware sensors DO provide this information. But unfortunately the sensor API defined in Android defines the proximity to be a boolean i.e NEAR(1) OR FAR(0).

To get a boolean reading from the actual distance, the distance obtained from the proximity sensor hardware is compared with a threshold value. This is often done in the sensor-HAL.

Also some light/proximity sensor-hardware ICs provide a proximity boolean themselves. In this case, the threshold is configurable in the hardware. The hardware compares each sample obtained with the threshold internally and then reports the boolean "proximity".

Irrespective of the kind of sensor hardware in use, Android (upto v4.1 "jelly-bean") does NOT expose the proximity distance parameter as part of its sensor API. One can modify the sensor-HAL or try to interact with the proximity sensor driver directly (usually a sys-fs entry).

More details of Light/Proximity sensor on Android.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜