如何以编程方式打开Android棉花糖上特定应用的权限屏幕? [英] How to programmatically open the Permission Screen for a specific app on Android Marshmallow?

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

问题描述

我对新的Android Marshmallow版本有疑问:

I have a question regarding the new Android 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 - I would appreciate every help!

推荐答案

根据棉花糖许可视频(在

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棉花糖上特定应用的权限屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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