Exactly how much power is drained by registering a broadcast receiver for ACTION_BATTERY_CHANGED?

社会主义新天地 提交于 2019-12-12 11:26:16

问题


I am planning to write an app whose sole purpose will be to monitor the battery level, and launch an intent the moment it drops below a certain level. My one concern is that this itself will be a battery drain, and no one will want to use it.

So my question is: Exactly how much power is drained by using the ACTION_BATTERY_CHANGED broadcast receiver? Does anyone know approximately how much battery life we're talking about?


回答1:


I don't think you'll drain much power. This broadcast is sent only when level changes by one percent,

For example: 85% -> 86% or 76% -> 75%.

Android OS already tracks battery level (it has to track it in order to shutdown phone when level becomes too low, ~3-5%). So just subscribing to this broadcast shouldn't even be noticeable to the user (in terms of battery performance).



来源:https://stackoverflow.com/questions/6239809/exactly-how-much-power-is-drained-by-registering-a-broadcast-receiver-for-action

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!