简体   繁体   English

如何使用android管理API获取运行时权限?

[英]How to get runtime time permissions using android management API?

I am using the Android Management API to get runtime permission android.permission.SYSTEM_ALERT_WINDOW .我正在使用Android管理 API 来获得运行时权限android.permission.SYSTEM_ALERT_WINDOW The app is going to be installed on fully managed devices.该应用程序将安装在完全托管的设备上。 The policy has the below permissions defined:-该策略定义了以下permissions :-

defaultPermissionPolicy: "GRANT"

I have added this to the application section of the policy as well.我也将此添加到政策的应用程序部分。 However, the app does not obtain these permissions and the user has to manually go to the settings and enable this permission.但是,应用程序没有获得这些权限,用户必须手动 go 设置并启用此权限。 I understand that this permission is rated as advanced level permission, but this is a fully managed device.我了解此权限被评为高级权限,但这是一个完全托管的设备。

Android Management API defaultPermissionPolicy can only grant/deny runtime permission requests. Android 管理 API defaultPermissionPolicy 只能授予/拒绝运行时权限请求。 For example, READ_CONTACTS, WRITE_CONTACTS, ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION and etc.例如,READ_CONTACTS、WRITE_CONTACTS、ACCESS_FINE_LOCATION、ACCESS_COARSE_LOCATION 等。

SYSTEM_ALERT_WINDOW is a special permission . SYSTEM_ALERT_WINDOW 是一个特殊权限 This permission doesn't behave like a dangerous or normal permission.此权限的行为不像危险或正常的权限。 This is a sensitive permission that needs user authorization.这是需要用户授权的敏感权限。

For more information you may refer to this link .有关更多信息,您可以参考此链接

I had the same problem with AE.我对AE也有同样的问题。 The solution was set targetSdkVersion to 19 in your app.解决方案在您的应用程序中将targetSdkVersion设置为19

To fully benefit from android.permission.SYSTEM_ALERT_WINDOW , it's usually necessary to request also Draw over other apps which is special permission that the user must grant manually per app.为了充分受益于android.permission.SYSTEM_ALERT_WINDOW ,通常还需要在其他应用程序上请求绘制,这是用户必须为每个应用程序手动授予的特殊权限。 It's nicely described here . 这里描述得很好

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM