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

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

问题描述

我正在开发新的权限模型(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?

不仅是应用程序详细信息

not only application details

我设法使用类似的方法打开第二个屏幕

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.

您的帮助将不胜感激:)

Your help will be much appreciated :)

推荐答案

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

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

请参阅此问题以获取更多说明.

Refer to this question for more explanations.

我在这里共享代码以打开应用程序设置屏幕,

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应用程序设置屏幕

For more you can refer Open Application Settings Screen Android

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

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