语言

NotificationChannel 构造函数

定义

重载

NotificationChannel(String, ICharSequence, NotificationImportance)

创建通知通道。

[Android.Runtime.Register(".ctor", "(Ljava/lang/String;Ljava/lang/CharSequence;I)V", "", ApiSince=26)]
public NotificationChannel(string? id, Java.Lang.ICharSequence? name, Android.App.NotificationImportance importance);
[<Android.Runtime.Register(".ctor", "(Ljava/lang/String;Ljava/lang/CharSequence;I)V", "", ApiSince=26)>]
new Android.App.NotificationChannel : string * Java.Lang.ICharSequence * Android.App.NotificationImportance -> Android.App.NotificationChannel

参数

id
String

通道的 ID。 每个包必须是唯一的。 如果该值太长,可能会截断该值。

name
ICharSequence

通道的用户可见名称。 当系统区域设置通过侦听 Intent#ACTION_LOCALE_CHANGED 广播更改时,可以重命名此通道。 建议的最大长度为 40 个字符;如果值太长,可能会截断该值。

importance
NotificationImportance

通道的重要性。 这会控制发布到此通道的中断性通知的方式。

特性

注解

创建通知通道。

Android 参考。android.app.NotificationChannel.NotificationChannel

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

适用于

NotificationChannel(String, String, NotificationImportance)

创建通知通道。

[Android.Runtime.Register(".ctor", "(Ljava/lang/String;Ljava/lang/CharSequence;I)V", "", ApiSince=26)]
public NotificationChannel(string? id, string? name, Android.App.NotificationImportance importance);
[<Android.Runtime.Register(".ctor", "(Ljava/lang/String;Ljava/lang/CharSequence;I)V", "", ApiSince=26)>]
new Android.App.NotificationChannel : string * string * Android.App.NotificationImportance -> Android.App.NotificationChannel

参数

id
String

字符串:通道的 ID。 每个包必须是唯一的。 如果该值太长,可能会截断该值。

name
String

CharSequence:通道的用户可见名称。 当系统区域设置通过侦听Intent.ACTION_LOCALE_CHANGED广播来更改时,可以重命名此通道。 建议的最大长度为 40 个字符;如果值太长,可能会截断该值。

importance
NotificationImportance

int:通道的重要性。 这会控制发布到此通道的中断性通知的方式。 值为下列值之一:NotificationManager.IMPORTANCE_UNSPECIFIED NotificationManager.IMPORTANCE_NONE NotificationManager.IMPORTANCE_MIN NotificationManager.IMPORTANCE_LOW NotificationManager.IMPORTANCE_DEFAULT NotificationManager.IMPORTANCE_HIGH

特性

注解

创建通知通道。

Android 参考。android.app.NotificationChannel.NotificationChannel

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

适用于