Unregistering SensorManager doesn't work

前端 未结 3 1046
误落风尘
误落风尘 2021-01-15 04:42

In my app, I am using the light and proximity sensor to detect phone out of pocket functionality and then unregistering the SensorManager when their detection is complete. B

3条回答
  •  清歌不尽
    2021-01-15 05:11

    mSensorManager.registerListener(YourListener.this, mSensorManager
                        .getDefaultSensor(Sensor.TYPE_LINEAR_ACCELERATION),
                        SensorManager.SENSOR_DELAY_NORMAL);
    

    take this to register your Listener... then works your unregisterListener

提交回复
热议问题