How to check if the Battery Saver Mode is enabled on Android < 5.0?

旧街凉风 提交于 2020-06-13 17:44:33

问题


As I know, there are some devices with version < 5.0 that have the Power Saver option.

An answer provided in this similar question is not correct and doesn't explain anything.

On Android 5.0+ we can use this script here:

PowerManager powerManager = (PowerManager) this.getSystemService(Context.POWER_SERVICE);
if ( powerManager.isPowerSaveMode()) {
    //code
}

My question is: is there a universal way to check if there IS a power saver mode and if it's enabled/disabled on API < 21?


回答1:


For KitKat and below power saving is not a standard feature enabled in the stock android but some manufacturers implement this through some different methods. So there are no standard ways for checking this.



来源:https://stackoverflow.com/questions/39701140/how-to-check-if-the-battery-saver-mode-is-enabled-on-android-5-0

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