I want to have my control to make display remain turn on on some event and release my control on display turn on/off based on some other event. I know that I can easily do this using wakelock. But device battery life will be significantly aff开发者_JAVA百科ected by the use of this API. Is there any other way to do so?
It is good that you are considering battery consumption in your app, however, what you are effectively asking is if there's any way to make the display use less power, since regardless of the method used to keep it on, you are keeping the display on.
Since the display is usually the largest battery drain on modern smartphones, I'm afraid the answer is no, there is no way to keep the display enabled and at the same time significantly reduce power consumption.
You may be able to dim the display, but that is unlikely to result in a significant power saving and WakeLocks are the correct way to use this functionality.
Battery life will be significantly affected by your app keeping the scree on all the time, so you must think twice if you want your app to use this functionality. If you indeed need this option, you can use getCurrentFocus().setKeepScreenOn(true);
Hope this helps.
精彩评论