Question

In reviewing this post Android: I want to shake it, the highest rated answer says you should unregister and reregister the listener for the accelerometer onStop and onResume to conserve battery life.

My question is how do we know which listeners we need to stop/resume to minimize our applications footprint on battery life? Things like do OnClickListener, TextWatcher() etc - do they need to be changed?

and if anyone knows, what about adMob's SimpleAdListener?

I sort of assumed that the UI listeners don't consume battery if the Activity doesn't have focus. As for the SimpleAdListener I have no idea....

Was it helpful?

Solution

My question is how do we know which listeners we need to stop/resume to minimize our applications footprint on battery life? Things like do OnClickListener, TextWatcher() etc - do they need to be changed?

If it ties into hardware, you should consider unregistering the listener. Accelerometer, GPS, etc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top