How can an Android listener be created to perform a task just before entering power save mode? Also: what are some of the low power options that can be controlled by this task?
In our tests, both iPhones and Android smartphones used significantly less battery power with battery-saver mode enabled—as much as 54 percent, depending on the phone we used.
Power saving mode in phones usually do not change the CPU settings(Manipulating CPU configurations is usually not possible without first rooting the phone). So they do not affect the performance noticeably.
Click the battery icon on the right side of the Taskbar. Select Battery settings. Scroll down to the Battery saver section, and disable the check box next to Turn battery saver on automatically if my battery falls below.
When turned on, 'Power saving mode' reduces your device's performance and limits vibration, location services and most background data. From a Home screen, swipe up or down from the center of the display to access the apps screen.
The answer above(for API 21 and above) is not exactly right. You should register a receiver in your activity or service like this:
BroadcastReceiver powerSaverChangeReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
checkPowerSaverMode();
}
};
IntentFilter filter = new IntentFilter();
filter.addAction("android.os.action.POWER_SAVE_MODE_CHANGED");
registerReceiver(powerSaverChangeReceiver, filter);
The reason for this is that receivers in manifest are not triggered by this broadcast.
ACTION_POWER_SAVE_MODE_CHANGED
Intent that is broadcast when the state of isPowerSaveMode() changes. This broadcast is only sent to registered receivers.
I have tested this and it works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With