语言

NotificationManager.CreateNotificationChannel(NotificationChannel) 方法

定义

创建一个通知通道,通知可以发布到该通道。

[Android.Runtime.Register("createNotificationChannel", "(Landroid/app/NotificationChannel;)V", "GetCreateNotificationChannel_Landroid_app_NotificationChannel_Handler", ApiSince=26)]
public virtual void CreateNotificationChannel(Android.App.NotificationChannel channel);
[<Android.Runtime.Register("createNotificationChannel", "(Landroid/app/NotificationChannel;)V", "GetCreateNotificationChannel_Landroid_app_NotificationChannel_Handler", ApiSince=26)>]
abstract member CreateNotificationChannel : Android.App.NotificationChannel -> unit
override this.CreateNotificationChannel : Android.App.NotificationChannel -> unit

参数

channel
NotificationChannel

NotificationChannel:要创建的通道。 请注意,创建的通道可能与此值不同。 如果提供的通道格式不正确,将引发 RemoteException。 此值不能为 null。

特性

注解

创建一个通知通道,通知可以发布到该通道。 这还可用于还原已删除的通道,以及更新现有通道的名称、说明、组和/或重要性。 仅当区域设置更改或响应重命名此通道的用户时,才应更改名称和说明。 例如,如果用户具有名为“Messages”的通道,并且用户更改其区域设置,则应使用新区域设置中的“Messages”翻译来更新此通道的名称。 仅当新重要性低于当前值且用户尚未更改此通道上的任何设置时,现有通道的重要性才会更改。 仅当通道尚不属于组时,才会更改现有通道的组。 对于已存在的通道,将忽略所有其他字段。

Android 参考。android.app.NotificationManager.createNotificationChannel

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于