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!
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.
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.
Intent intentBatteryUsage = new Intent(Intent.ACTION_POWER_USAGE_SUMMARY);
startActivity(intentBatteryUsage);
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