如何以编程方式在应用程序设置中打开应用程序权限 window

How to open application permission window in app settings programmatically

我正在研究新的权限模型 (Android 6.0 Marshmallow),我想知道有没有办法以编程方式打开应用程序的权限 window?

不仅是申请详情

我使用类似的方法成功打开了第二个屏幕

private void goToSettings() {
    Intent myAppSettings = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse("package:" + getPackageName()));
    myAppSettings.addCategory(Intent.CATEGORY_DEFAULT);
    myAppSettings.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(myAppSettings);
}

但是不知道第一个怎么打开

非常感谢您的帮助:)

这是不可能的。您可以打开应用程序设置屏幕,但不能打开权限设置屏幕。

更多解释请参考this question

这里分享打开应用设置界面的代码,

Intent intent = new Intent();
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
Uri uri = Uri.fromParts("package", activity.getPackageName(), null);
intent.setData(uri);
context.startActivity(intent);

更多可以参考Open Application Settings Screen Android