Is it possible to know whether Battery Saver is enabled?

Basically just trying to get the status of the battery saver mode to trigger my code appropriately, but I can't find the needed method to get that...

  • Hello,

    If you're using Android, you can get the current Battery Saver status with PowerManager:

    PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
    boolean isBatterySaverOn = powerManager.isPowerSaveMode();

    If you also want to react when the user toggles Battery Saver, listen for the PowerManager.ACTION_POWER_SAVE_MODE_CHANGED broadcast. That way your code updates automatically when the mode changes.