如何在 Android 6.0 (Marshmallow) 上以编程方式打开特定应用程序的权限屏幕? [英] How can I programmatically open the permission screen for a specific app on Android 6.0 (Marshmallow)?

查看:35
本文介绍了如何在 Android 6.0 (Marshmallow) 上以编程方式打开特定应用程序的权限屏幕?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于新的 Android 6.0 (Marshmallow) 版本的问题:

I have a question regarding the new Android 6.0 (Marshmallow) release:

是否可以通过 Intent 或类似方式显示特定应用的权限屏幕?

Is it achievable to display the permission screen for a specific app via an Intent or something similar?

可以使用以下代码显示应用设置 - 是否有直接打开权限屏幕的模拟解决方案?

It's possible to display the app settings with the following code - is there an analog solution for directly opening the permission screen?

startActivity(new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
Uri.fromParts("package", getPackageName(), null)));

我已经对此进行了一些研究,但找不到合适的解决方案.

I already did some research on this, but I wasn't able to find a proper solution.

推荐答案

根据官方 Marshmallow 权限视频(位于 4m 43s 标记),您必须改为打开应用程序设置页面(从那里单击到权限页面).

According to the official Marshmallow permissions video (at the 4m 43s mark), you must open the application Settings page instead (from there it is one click to the Permissions page).

要打开设置页面,你会这样做

To open the settings page, you would do

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

这篇关于如何在 Android 6.0 (Marshmallow) 上以编程方式打开特定应用程序的权限屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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