托管配置文件中的Android请勿打扰(DnD)权限 [英] Android Do not Disturb (DnD) permission in managed profile

查看:534
本文介绍了托管配置文件中的Android请勿打扰(DnD)权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下问题:

我的应用程序分布在MDM系统上,并在Android for Work中运行. 在某些情况下,应用必须暂时终止DnD模式.为此,用户必须在启动应用程序时授予DnD权限.

My app is distributed over an MDM system and runs in Android for Work. In certain situation, the app must temporarily terminate the DnD mode. To achieve this, the user must grant the DnD permission when the app is started.

到目前为止,一切都很好.如果我在非托管区域安装了该应用程序,则该应用程序将显示在列表中,并且可以毫无问题地授予该权限. 通过MDM系统分发应用程序后,该应用程序将不再出现在列表中,并且无法授予该权限.在MDM系统中已授予所有授权.例如,我已经在MDM系统上分发了Google App.该应用程序将显示在列表中.

So far so good. If I install the app in the unmanaged area, the app shows up in the list and the permission can be granted without any problems. As soon as the app is distributed via an MDM system, the app no longer appears in the list and the permission cannot be granted. All authorizations have been granted in the MDM system. As an example, I have distributed the Google App over the MDM system. This app appears in the list.

在清单中,我设置了以下权限:

In the Manifest I have set the following permission:

<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY" />

启动应用程序后,将执行以下代码:

When the app is started, the following code is executed:

NotificationManager nm = (NotificationManager).getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M && !nm.isNotificationPolicyAccessGranted()) {
  Intent intent = new
  Intent(Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS);
  startActivity(intent);
}

该问题仅在DnD权限下发生.所有其他权限(例如覆盖权限)都可以正常显示.

The problem only occurs with DnD permission. All other permissions such as overlay permission, are displayed without problems.

我希望任何人都能帮助我.

I hope anyone can help me.

推荐答案

根据 Android文档:不可能

用户可以从此处授予和拒绝对请勿打扰"配置的访问权限.托管配置文件无法授予请勿打扰"访问权限.

Users can grant and deny access to Do Not Disturb configuration from here. Managed profiles cannot grant Do Not Disturb access.

这篇关于托管配置文件中的Android请勿打扰(DnD)权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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