如何检查是否在Android<上启用了省电模式5.0?

问题描述:

据我所知,有些设备的版本为< 5.0带有节电器选项。

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.

在Android 5.0以上版本,我们可以在此处使用此脚本:

On Android 5.0+ we can use this script here:

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

我的问题是:
有一种通用的方法来检查是否存在省电模式以及是否在API<上启用/禁用了该模式。 21?

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?

对于KitKat及以下版本,节电不是库存android中启用的标准功能,但是有些制造商通过一些不同的方法。因此,没有标准的方法可以对此进行检查。

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.