How to open Manage apps battery usage settings in MIUI devices programmatically?
I open the settings by this:
startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0);
But I don't know how to open Manage apps battery usage settings in MIUI devices.
Select Additional SettingsGo to Battery & Performance. Tap on Manage apps' battery usage. On this screen switch off Power Saving Mode.
The way the app works is by force closing the background apps and services that are draining the battery unnecessary, and also the app lowers the screen brightness to save battery and make your device last longer.
The 'Ultra Battery-Saver' mode brings the battery usage and the standby time to “the next level” which Xiaomi revealed restricts all kind of background activity. Users will be able to use only six 'non-essential' apps other than calls, SMS and network connectivity.
You can try few methods below:
Personally i don't have 5.1 devices but tried it over simulator
Intent batterySaver = new Intent();
battSaverIntent.setComponent(new ComponentName("com.android.settings", "com.android.settings.Settings$BatterySaverSettingsActivity"));
startActivityForResult(batterySaver, 0);
or for summary usage
Intent batterySaver = new Intent(Intent.ACTION_POWER_USAGE_SUMMARY);
startActivity(batterySaver);
Documentation link here
For API level >22
startActivityForResult(new Intent(Settings.ACTION_BATTERY_SAVER_SETTINGS), 0);
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