DevicePolicyManager.SetPermittedCrossProfileNotificationListeners 方法

定义

由托管配置文件的配置文件所有者调用,以设置允许在主用户中使用 android.service.notification.NotificationListenerService 包来查看托管配置文件中的通知。

[Android.Runtime.Register("setPermittedCrossProfileNotificationListeners", "(Landroid/content/ComponentName;Ljava/util/List;)Z", "GetSetPermittedCrossProfileNotificationListeners_Landroid_content_ComponentName_Ljava_util_List_Handler", ApiSince=26)]
public virtual bool SetPermittedCrossProfileNotificationListeners (Android.Content.ComponentName admin, System.Collections.Generic.IList<string>? packageList);
[<Android.Runtime.Register("setPermittedCrossProfileNotificationListeners", "(Landroid/content/ComponentName;Ljava/util/List;)Z", "GetSetPermittedCrossProfileNotificationListeners_Landroid_content_ComponentName_Ljava_util_List_Handler", ApiSince=26)>]
abstract member SetPermittedCrossProfileNotificationListeners : Android.Content.ComponentName * System.Collections.Generic.IList<string> -> bool
override this.SetPermittedCrossProfileNotificationListeners : Android.Content.ComponentName * System.Collections.Generic.IList<string> -> bool

参数

admin
ComponentName

DeviceAdminReceiver此请求与此请求相关联。

packageList
IList<String>

要允许列表的包名称列表

返回

如果设置限制成功,则为 true。 如果在托管配置文件外部调用,它将失败

属性

注解

由托管配置文件的配置文件所有者调用,以设置允许在主用户中使用 android.service.notification.NotificationListenerService 包来查看托管配置文件中的通知。 默认情况下,此策略允许所有包。 添加零个或多个包后,未在列表中的主要用户上安装的通知侦听器,并且不是系统的一部分,将不会接收托管配置文件通知的事件。

使用 null 列表值进行调用将禁用限制,以便使用所有通知侦听器服务。 使用空列表进行调用将禁用系统自己的通知侦听器。 系统通知侦听器服务始终可供用户使用。

如果设备或配置文件所有者希望阻止其用户中的通知侦听器看到该用户的通知,则应阻止该服务改为运行(例如通过 #setApplicationHidden(ComponentName, String, boolean)

适用于 . 的 android.app.admin.DevicePolicyManager.setPermittedCrossProfileNotificationListeners(android.content.ComponentName, java.util.List<java.lang.String>)Java 文档

本页的某些部分是根据 Android 开放源代码项目创建和共享的工作进行的修改,并根据 Creative Commons 2.5 属性许可证中所述的术语使用。

适用于