问题
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