Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open Battery Use in About Device part of Settings Programatically in android?

i am developing an android app where i want to open the Battery use intent which is present in About device part of settings programatically. I am using the below code for it.

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

The above code opens the About Device intent. But i want to open the Battery use option which is inside the About device part of Settings. Not getting how to do it. Please Help! Thanks!

like image 681
sanjana Avatar asked Nov 15 '13 11:11

sanjana


People also ask

How do I open my battery settings?

Select the Start button, and then select Settings > System > Battery. By default, battery saver turns itself on when your battery level goes below 20%, but you can adjust this in Battery settings.

How check battery consumption in android programmatically?

Go to the activity_main. xml file, which represents the UI of the project. Add a Button, so whenever the user will click on the Button a Toast message with battery percentage will be popped up on the screen.


1 Answers

Intent intentBatteryUsage = new Intent(Intent.ACTION_POWER_USAGE_SUMMARY);        
startActivity(intentBatteryUsage);
like image 69
Broak Avatar answered Sep 21 '22 19:09

Broak