如何以编程方式在应用设置中打开应用权限窗口 [英] How to open application permission window in app settings programmatically

查看:37
本文介绍了如何以编程方式在应用设置中打开应用权限窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm working on new permission model (Android 6.0 Marshmallow) and I wonder is there a way to open the application's permission window programmatically?

不仅是申请详情

我设法使用这样的东西打开了第二个屏幕

I managed to open the second screen using something like this

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);
}

但我不知道如何打开第一个.

But I have no idea how to open the first one.

非常感谢您的帮助:)

推荐答案

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

This is not possible. You can open the App settings screen but not the permissions setting screen.

参考这个问题以获得更多解释.

这里我分享了打开应用程序设置屏幕的代码,

Here I am sharing code to open application setting screen,

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);

更多可以参考打开应用程序设置屏幕Android

这篇关于如何以编程方式在应用设置中打开应用权限窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆