开发者

Android registerListener and battery life

开发者 https://www.devze.com 2022-12-28 23:40 出处:网络
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 b

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消