Android registerListener and battery life
In reviewing this post Android: I want to shake it, the highest rated answer says you should unregister and reregister the listener for the 开发者_Go百科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....
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.
精彩评论