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

前端 未结 2 1556
别跟我提以往
别跟我提以往 2021-01-13 21:54

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 i

2条回答
  •  盖世英雄少女心
    2021-01-13 23:00

    Try this..

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

提交回复
热议问题