共用方式為


NotificationManager.CreateNotificationChannel(NotificationChannel) Method

Definition

Creates a notification channel that notifications can be posted to.

[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

Parameters

channel
NotificationChannel

the channel to create. Note that the created channel may differ from this value. If the provided channel is malformed, a RemoteException will be thrown.

Attributes

Remarks

Creates a notification channel that notifications can be posted to.

This can also be used to restore a deleted channel and to update an existing channel's name, description, group, and/or importance.

The name and description should only be changed if the locale changes or in response to the user renaming this channel. For example, if a user has a channel named 'Messages' and the user changes their locale, this channel's name should be updated with the translation of 'Messages' in the new locale.

The importance of an existing channel will only be changed if the new importance is lower than the current value and the user has not altered any settings on this channel.

The group an existing channel will only be changed if the channel does not already belong to a group.

All other fields are ignored for channels that already exist.

Java documentation for android.app.NotificationManager.createNotificationChannel(android.app.NotificationChannel).

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