Reputation: 5404
I want to get the precise distance from the device's proximity sensor to live object.
The only thing that I get is "0.0" - for near distance, and "8.0"/"7.0"(vary from on device to other) - for far distance.
thats how I use to get the distance:
@Override
public final void onSensorChanged(SensorEvent event)
{
final float distanceX = event.values[0];
}
Is there a way to get the precise distance?
thanks in advance!
Upvotes: 4
Views: 3735
Reputation: 10031
The guide to position sensors says the following about proximity sensors:
Most proximity sensors return the absolute distance, in cm, but some return only near and far values.
so precision is device-dependent.
Upvotes: 1