作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我有以下问题:
我的应用程序分布在 MDM 系统上,并在 Android for Work 中运行。在某些情况下,应用程序必须暂时终止 DnD 模式。为此,用户必须在应用启动时授予 DnD 权限。
到目前为止一切顺利。如果我在非托管区域安装该应用程序,该应用程序会显示在列表中并且可以毫无问题地授予权限。通过 MDM 系统分发应用程序后,该应用程序将不再出现在列表中,并且无法授予权限。所有权限都已在 MDM 系统中授予。例如,我通过 MDM 系统分发了 Google App。此应用出现在列表中。
在 list 中我设置了以下权限:
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY" />
应用程序启动时,将执行以下代码:
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 权限才会出现此问题。所有其他权限(例如覆盖权限)都可以正常显示。
我希望有人能帮助我。
最佳答案
根据 Android documentation : 不可能
Users can grant and deny access to Do Not Disturb configuration from here. Managed profiles cannot grant Do Not Disturb access.
关于受管理配置文件中的 Android 请勿打扰 (DnD) 权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48567956/
我是一名优秀的程序员,十分优秀!