I'm trying to develop simple Android app using light sensor. Unfortunately although my SE Xperia Arc S does have light sensor I can't get it working. Simple code presented below returns null. I was checking light sensor in Service Test using *#*#7378423#*#* and Service Test -> Ambient Light Sensor and it is working there.
Returning null:
sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
return mySensorManager.getDefaultSensor(Sensor.TYPE_LIGHT);
This code returns list of sensors, missing light sensor:
mySensorManager.getSensorList(Sensor.TYPE_ALL);
I have checked light sensor apps in the market, doesn't work either.
Phone info:
LT18i, Android version: 2.3.4, Compilation: 4.0.2.A.0.42
Any ideas?
Thanks for help.