Partager via


NotificationListenerService.GetNotificationChannels Method

Definition

Returns all notification channels belonging to the given package for a given user.

[Android.Runtime.Register("getNotificationChannels", "(Ljava/lang/String;Landroid/os/UserHandle;)Ljava/util/List;", "", ApiSince=26)]
public System.Collections.Generic.IList<Android.App.NotificationChannel>? GetNotificationChannels (string pkg, Android.OS.UserHandle user);
[<Android.Runtime.Register("getNotificationChannels", "(Ljava/lang/String;Landroid/os/UserHandle;)Ljava/util/List;", "", ApiSince=26)>]
member this.GetNotificationChannels : string * Android.OS.UserHandle -> System.Collections.Generic.IList<Android.App.NotificationChannel>

Parameters

pkg
String

The package to retrieve channels for.

user
UserHandle

Returns

Attributes

Remarks

Returns all notification channels belonging to the given package for a given user.

This method will throw a security exception if you don't have access to notifications for the given user.

The caller must have CompanionDeviceManager#getAssociations() an associated device or be the NotificationAssistantService notification assistant in order to use this method.

Java documentation for android.service.notification.NotificationListenerService.getNotificationChannels(java.lang.String, android.os.UserHandle).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to