Is there a way in Android studio of polling the light sensors rather than waiting for a SensorEvent?

78 Views Asked by At

I need a very high rate of information from the light_sensor in android studio and i can't get it with an event so i want the real time information if its possible

@Override
            public void onSensorChanged(SensorEvent event) {
                float value = event.values[0];
                currentTime = Calendar.getInstance().getTime();
                result[i] = formatter.format(currentTime);
                tab[i]=(int)value;
                Text.setText(String.valueOf(value));
                i=i+1;
            }
1

There are 1 best solutions below

1
Chrystian On

I think you mean on Android, and not in Android Studio. Android Studio is the IDE that you are using.

In general the light sensor on most Android devices only returns an onsensorchanged event when the light intensity changed.