CompanionDeviceManager.HasNotificationAccess(ComponentName) 方法

定义

检查给定组件是否可以通过 a 访问通知 NotificationListenerService

        Your app must have an association with a device before calling this API
[Android.Runtime.Register("hasNotificationAccess", "(Landroid/content/ComponentName;)Z", "", ApiSince=26)]
public bool HasNotificationAccess(Android.Content.ComponentName? component);
[<Android.Runtime.Register("hasNotificationAccess", "(Landroid/content/ComponentName;)Z", "", ApiSince=26)>]
member this.HasNotificationAccess : Android.Content.ComponentName -> bool

参数

component
ComponentName

组件的名称

返回

给定组件是否具有通知侦听器权限

属性

注解

检查给定组件是否可以通过 a 访问通知 NotificationListenerService

在调用此 API 之前,你的应用必须与设备关联

调用此 API 需要在清单中使用功能 PackageManager#FEATURE_COMPANION_DEVICE_SETUP 声明

此成员已弃用。 请改用 NotificationManager#isNotificationListenerAccessGranted(ComponentName)

适用于 . 的 android.companion.CompanionDeviceManager.hasNotificationAccess(android.content.ComponentName)Java 文档

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

适用于