The light sensor on the Nexus One only returns two separate values

I am trying to read the values ​​of the light sensor of my Nexus One, but I leave only the following values:

10.0

225.0

and in some cases, some values ​​are much higher.

Used code:

sensorManager = (SensorManager) context .getSystemService(Context.SENSOR_SERVICE); sensor = sensorManager.getDefaultSensor(Sensor.TYPE_LIGHT); listener = new SensorEventListener() { @Override public void onAccuracyChanged(Sensor sensor, int accuracy) { } @Override public void onSensorChanged(SensorEvent event) { Log.d(Constants.TAG, "Brightness: " + event.values[0]); } }; sensorManager.registerListener(listener, sensor, SensorManager.SENSOR_DELAY_NORMAL); } 

Does anyone have any experience with a light sensor on a Nexus One or other Android device? Is my code the correct way to read values? How can I get more accurate values?

+4
source share
1 answer

Your code looks great. I got the following values: 10, 225, 320, 640, 1280, 2600, 3200, 10240. But I really needed to point the device to the sun in order to get higher values.

Edit: from the characteristics of the light sensor, which can be obtained on my phone using the Android API - 10240, is the highest value that can be returned by this sensor.

+1
source

All Articles