Udostępnij za pośrednictwem


NotificationChannel Class

Definition

A representation of settings that apply to a collection of similarly themed notifications.

[Android.Runtime.Register("android/app/NotificationChannel", ApiSince=26, DoNotGenerateAcw=true)]
public sealed class NotificationChannel : Java.Lang.Object, Android.OS.IParcelable, IDisposable, Java.Interop.IJavaPeerable
[<Android.Runtime.Register("android/app/NotificationChannel", ApiSince=26, DoNotGenerateAcw=true)>]
type NotificationChannel = class
    inherit Object
    interface IParcelable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Inheritance
NotificationChannel
Attributes
Implements

Remarks

A representation of settings that apply to a collection of similarly themed notifications.

Java documentation for 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.

Constructors

NotificationChannel(String, ICharSequence, NotificationImportance)

Creates a notification channel.

NotificationChannel(String, String, NotificationImportance)

Fields

DefaultChannelId

The id of the default channel for an app.

EditConversation

Extra value for Settings#EXTRA_CHANNEL_FILTER_LIST.

EditImportance

Extra value for Settings#EXTRA_CHANNEL_FILTER_LIST.

EditLauncher

Extra value for Settings#EXTRA_CHANNEL_FILTER_LIST.

EditLockedDevice

Extra value for Settings#EXTRA_CHANNEL_FILTER_LIST.

EditSound

Extra value for Settings#EXTRA_CHANNEL_FILTER_LIST.

EditVibration

Extra value for Settings#EXTRA_CHANNEL_FILTER_LIST.

EditZen

Extra value for Settings#EXTRA_CHANNEL_FILTER_LIST.

Properties

AudioAttributes

Returns the audio attributes for sound played by notifications posted to this channel.

Blockable

Returns whether this channel is always blockable, even if the app is 'fixed' as non-blockable. -or- Allows users to block notifications sent through this channel, if this channel belongs to a package that otherwise would have notifications "fixed" as enabled.

Class

Returns the runtime class of this Object.

(Inherited from Object)
ConversationId

Returns the ShortcutInfo#getId() id of the conversation backing this channel, if it's associated with a conversation.

Creator
Description

Returns the user visible description of this channel. -or- Sets the user visible description of this channel.

Group

Returns what group this channel belongs to. -or- Sets what group this channel belongs to.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
HasUserSetImportance

Returns whether the user has chosen the importance of this channel, either to affirm the initial selection from the app, or changed it to be higher or lower.

HasUserSetSound

Returns whether the user has chosen the sound of this channel.

Id

Returns the id of this channel.

Importance

Returns the user specified importance e. -or- Sets the level of interruption of this notification channel.

IsConversation

Whether or not this channel represents a conversation.

IsDemoted

Returns whether the user has decided that this channel does not represent a conversation.

IsImportantConversation

Whether or not notifications in this conversation are considered important.

JniIdentityHashCode (Inherited from Object)
JniPeerMembers
LightColor

Returns the notification light color for notifications posted to this channel. -or- Sets the notification light color for notifications posted to this channel, if lights are #enableLights(boolean) enabled on this channel and the device supports that feature.

LockscreenVisibility

Returns whether or not notifications posted to this channel are shown on the lockscreen in full or redacted form. -or- Sets whether notifications posted to this channel appear on the lockscreen or not, and if so, whether they appear in a redacted form.

Name
NameFormatted

Returns the user visible name of this channel. -or- Sets the user visible name of this channel.

ParentChannelId

Returns the #getId() id of the parent notification channel to this channel, if it's a conversation related channel.

PeerReference (Inherited from Object)
Sound

Returns the notification sound for this channel.

ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)

Methods

CanBubble()

Returns whether notifications posted to this channel are allowed to display outside of the notification shade, in a floating window on top of other apps.

CanBypassDnd()

Whether or not notifications posted to this channel can bypass the Do Not Disturb NotificationManager#INTERRUPTION_FILTER_PRIORITY mode.

CanShowBadge()

Returns whether notifications posted to this channel can appear as badges in a Launcher application.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
DescribeContents()
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
EnableLights(Boolean)

Sets whether notifications posted to this channel should display notification lights, on devices that support that feature.

EnableVibration(Boolean)

Sets whether notification posted to this channel should vibrate.

Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetVibrationPattern()

Returns the vibration pattern for notifications posted to this channel.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
SetAllowBubbles(Boolean)

As of Android 11 this value is no longer respected.

SetBypassDnd(Boolean)

Sets whether or not notifications posted to this channel can interrupt the user in android.app.NotificationManager.Policy#INTERRUPTION_FILTER_PRIORITY mode.

SetConversationId(String, String)

Sets this channel as being converastion-centric.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetShowBadge(Boolean)

Sets whether notifications posted to this channel can appear as application icon badges in a Launcher.

SetSound(Uri, AudioAttributes)

Sets the sound that should be played for notifications posted to this channel and its audio attributes.

SetVibrationPattern(Int64[])

Sets the vibration pattern for notifications posted to this channel.

ShouldShowLights()

Returns whether notifications posted to this channel trigger notification lights.

ShouldVibrate()

Returns whether notifications posted to this channel always vibrate.

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
WriteToParcel(Parcel, ParcelableWriteFlags)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to