【问题标题】:How to open application permission window in app settings programmatically [duplicate]如何以编程方式在应用程序设置中打开应用程序权限窗口[重复]
【发布时间】:2016-05-29 03:52:00
【问题描述】:

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

不仅仅是申请细节

我设法用这样的方式打开了第二个屏幕

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

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

您的帮助将不胜感激:)

【问题讨论】:

    标签: android permissions android-6.0-marshmallow android-settings


    【解决方案1】:

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

    更多解释请参考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

    【讨论】:

    • 听到这个消息很难过。我希望有办法。感谢您指出关于 SO 的主要问题。 (我正在寻找答案,但错过了这个)再次感谢您。
    • 你是怎么解决的?卡罗尔·日格沃维奇
    • 有没有办法从特定应用程序打开任何其他应用程序设置?
    • 它对我有用,谢谢!!
    • 如果有人想知道android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS
    猜你喜欢
    • 2021-03-29
    • 2010-10-18
    • 2015-09-21
    • 1970-01-01
    • 2013-01-13
    • 1970-01-01
    • 2016-09-11
    • 2016-02-22
    相关资源
    最近更新 更多