0

I registered interrupt listener for light sensor. Listener gets event all the time even light level (lux) is not changed.

   if (DeviceInfoHelper.isSensorSupported(context, mHostAppPackageName, SensorTypeValue.LIGHT)) {

        lightSensor = sensorManager.getSensor(SensorTypeValue.LIGHT);
        try {
            if (lightSensor != null) {
                lightSensor.registerInterruptListener(this);
                Log.d(LOG_TAG, "register LightSensor ");
            } else {
                Log.w(LOG_TAG, "registerLightSensor: ERROR");
            }
        } catch (AccessorySensorException e) {
            e.printStackTrace();
        }
    }

1 Answers1

2

That is expected behavior of the API. You should be constantly getting events, not just when the light level changes. Is it causing an issue for you?

mldeveloper
  • 2,253
  • 1
  • 13
  • 14