打开设置电池优化白名单界面失败
执行函数时
private void ignoreBatteryOptimization(Activity activity) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){
PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE);
Intent intent = new Intent(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS);
intent.setData(Uri.parse("package:" + activity.getPackageName()));
startActivity(intent);
}
}
报 android.content.ActivityNotFoundException: No Activity found to handle Intent 错误;
请教大伙,这个是怎么回事?