如何在Android中以编程方式打开关于设备部分的电池使用?
问题描述:
我正在开发一个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!
答
Intent intentBatteryUsage = new Intent(Intent.ACTION_POWER_USAGE_SUMMARY);
startActivity(intentBatteryUsage);