How to open the "Battery" function in the "Device" section in the "Settings" section.

I am developing an Android application where I want to discover the intention to use the battery, which is present in the About section. I use the code below for this.

                 Intent i = new Intent();
                 i.setAction(android.provider.Settings.ACTION_DEVICE_INFO_SETTINGS);
                 startActivity(i);

The code above opens the intention "About device". But I want to open the option to use the battery, which is located inside the "About the application" in the "Settings" section. It doesn’t work out how to do this. Please help! Thank you

+2
source share
2 answers
Intent intentBatteryUsage = new Intent(Intent.ACTION_POWER_USAGE_SUMMARY);        
startActivity(intentBatteryUsage);
+14
source

Try it.

Intent powerUsageIntent = new Intent(Intent.ACTION_POWER_USAGE_SUMMARY);
ResolveInfo resolveInfo = getPackageManager().resolveActivity(powerUsageIntent, 0);             
if(resolveInfo != null){
         startActivity(powerUsageIntent);
}
+2
source

Source: https://habr.com/ru/post/1685791/


All Articles