bugshaker-android
bugshaker-android copied to clipboard
Activate accelerometer only when it's needed
Hello,
Apparently the library didn't stop listening the accelerometer.
It's start of the seismic lib shakeDetector.start(sensorManager)
but never call the stop method.
It could be useful to have only the accelerometer activated when it's needed.
This is worth looking into; there's probably a way to use the activity lifecycle hooks to know when the app is backgrounded (i.e. shake detection can safely be stopped).
Some of the code in https://github.com/stkent/STUtils should be able to take care of this now, with proper adaptation. One thing to think about is whether the Activity reference management can be rolled into the app lifecycle tracking code too.