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?
Jonathan roth
source share