Search code examples
androidsensorsproximity

Android - get proximity sensor min and max value


The app i am building makes use of the proximity sensor. Trying it in different phones i found that the proximity sensor has different (min,max) values in different phones (my htc sensation has 0 for covered and 9 for uncovered while xperia has 0 for covered and 1 for uncovered).So the question is: How do i get the proximity sensor's min max values ??


Solution

  • I think minimum value for proximity Sensor is 0 for all devices. and to get maximum range...

        SensorManager sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
        Sensor proximitySensor = sensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);
        proximitySensor.getMaximumRange();