Switching Android SensorManager speed. What's a good practice?

Posted by Johnson Tey on Stack Overflow See other posts from Stack Overflow or by Johnson Tey
Published on 2010-03-11T18:56:41Z Indexed on 2010/03/11 18:59 UTC
Read the original article Hit count: 289

Hello stackoverflow!
I'm interested to switch between different sensor orientation speeds over time to optimize the program ie.. battery life. The routine may be called very often. I'm looking for the right practice.

       sensorManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE);
       sensorManager.registerListener(sensorListener, SensorManager.SENSOR_ORIENTATION, SensorManager.SENSOR_DELAY_FASTEST);
       //... 1) unregister then register new speed OR
       //... 2) register new speed without registering
       sensorManager.unregisterListener(sensorListener);

Should I unregister the listener and then register with SensorManager.SENSOR_DELAY_NORMAL
OR
Should I not bother unregistering the listener?

thanks.

© Stack Overflow or respective owner

Related posts about android

Related posts about registration