Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open Manage apps battery usage settings in MIUI devices

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.

like image 855
Lila saad Avatar asked Sep 16 '17 08:09

Lila saad


People also ask

How do I turn off MIUI battery optimization?

Select Additional SettingsGo to Battery & Performance. Tap on Manage apps' battery usage. On this screen switch off Power Saving Mode.

What is App battery management?

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.

What does MIUI battery saver do?

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.


Video Answer


1 Answers

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);
like image 130
Rahul Khurana Avatar answered Oct 21 '22 08:10

Rahul Khurana