Notification Class

Definition

A class that represents how a persistent notification is to be presented to the user using the android.app.NotificationManager.

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

Remarks

A class that represents how a persistent notification is to be presented to the user using the android.app.NotificationManager.

The Notification.Builder Notification.Builder has been added to make it easier to construct Notifications.

<div class="special reference"> <h3>Developer Guides</h3>

For a guide to creating notifications, read the Status Bar Notifications developer guide.

</div>

Java documentation for android.app.Notification.

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

Notification()

Constructs a Notification object with default values.

Notification(Int32, ICharSequence)

Constructs a Notification object with the information needed to have a status bar icon without the standard expanded view.

Notification(Int32, ICharSequence, Int64)
Obsolete.

Constructs a Notification object with the information needed to have a status bar icon without the standard expanded view.

Notification(Int32, String)

Constructs a Notification object with the information needed to have a status bar icon without the standard expanded view.

Notification(Int32, String, Int64)

Constructs a Notification object with the information needed to have a status bar icon without the standard expanded view.

Notification(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Notification(Parcel)

Unflatten the notification from a parcel.

Fields

CategoryAlarm

Notification category: alarm or timer.

CategoryCall

Notification category: incoming call (voice or video) or similar synchronous communication request.

CategoryEmail

Notification category: asynchronous bulk message (email).

CategoryError

Notification category: error in background operation or authentication status.

CategoryEvent

Notification category: calendar event.

CategoryLocationSharing

Notification category: temporarily sharing location.

CategoryMessage

Notification category: incoming direct message (SMS, instant message, etc.

CategoryMissedCall

Notification category: missed call.

CategoryNavigation

Notification category: map turn-by-turn navigation.

CategoryProgress

Notification category: progress of a long-running background operation.

CategoryPromo

Notification category: promotion or advertisement.

CategoryRecommendation

Notification category: a specific, timely recommendation for a single thing.

CategoryReminder

Notification category: user-scheduled reminder.

CategoryService

Notification category: indication of running background service.

CategorySocial

Notification category: social network or sharing update.

CategoryStatus

Notification category: ongoing information about device or contextual status.

CategoryStopwatch

Notification category: running stopwatch.

CategorySystem

Notification category: system or device status update.

CategoryTransport

Notification category: media transport control for playback.

CategoryWorkout

Notification category: tracking a user's workout.

ColorDefault

Special value of #color telling the system not to decorate this notification with any special color but instead use default colors when presenting this notification.

ExtraAnswerColor

#extras key: the color used as a hint for the Answer action button of a android.app.Notification.CallStyle notification.

ExtraAnswerIntent

#extras key: the intent to be sent when the users answers a android.app.Notification.CallStyle notification.

ExtraAudioContentsUri

#extras key: the audio contents of this notification.

ExtraBackgroundImageUri

#extras key: flat String representation of a android.content.ContentUris content URI pointing to an image that can be displayed in the background when the notification is selected.

ExtraBigText

#extras key: this is the longer text shown in the big form of a BigTextStyle notification, as supplied to BigTextStyle#bigText(CharSequence).

ExtraCallIsVideo

#extras key: whether the android.app.Notification.CallStyle notification is for a call that will activate video when answered.

ExtraCallPerson

#extras key: the person to be displayed as calling for the android.app.Notification.CallStyle notification.

ExtraCallType

#extras key: the type of call represented by the android.app.Notification.CallStyle notification.

ExtraChannelGroupId

Optional extra for #INTENT_CATEGORY_NOTIFICATION_PREFERENCES.

ExtraChannelId

Optional extra for #INTENT_CATEGORY_NOTIFICATION_PREFERENCES.

ExtraChronometerCountDown

#extras key: whether the chronometer set on the notification should count down instead of counting up.

ExtraColorized

#extras key: whether the notification should be colorized as supplied to Builder#setColorized(boolean).

ExtraCompactActions

#extras key: the indices of actions to be shown in the compact view, as supplied to (e.

ExtraConversationTitle

#extras key: a CharSequence to be displayed as the title to a conversation represented by a android.app.Notification.MessagingStyle

ExtraDeclineColor

#extras key: the color used as a hint for the Decline or Hang Up action button of a android.app.Notification.CallStyle notification.

ExtraDeclineIntent

#extras key: the intent to be sent when the users declines a android.app.Notification.CallStyle notification.

ExtraHangUpIntent

#extras key: the intent to be sent when the users hangs up a android.app.Notification.CallStyle notification.

ExtraHistoricMessages

#extras key: an array of android.app.Notification.MessagingStyle#addHistoricMessage historicandroid.app.Notification.MessagingStyle.Message bundles provided by a android.app.Notification.MessagingStyle notification.

ExtraInfoText

#extras key: this is a small piece of additional text as supplied to Builder#setContentInfo(CharSequence).

ExtraIsGroupConversation

#extras key: whether the android.app.Notification.MessagingStyle notification represents a group conversation.

ExtraLargeIcon

#extras key: this is a bitmap to be used instead of the small icon when showing the notification payload, as supplied to Builder#setLargeIcon(android.graphics.Bitmap).

ExtraLargeIconBig

#extras key: this is a bitmap to be used instead of the one from Builder#setLargeIcon(android.graphics.Bitmap) when the notification is shown in its expanded form, as supplied to BigPictureStyle#bigLargeIcon(android.graphics.Bitmap).

ExtraMediaSession

#extras key: A android.media.session.MediaSession.Token associated with a android.app.Notification.MediaStyle notification.

ExtraMessages

#extras key: an array of android.app.Notification.MessagingStyle.Message bundles provided by a android.app.Notification.MessagingStyle notification.

ExtraMessagingPerson

#extras key: the person to be displayed for all messages sent by the user including direct replies android.app.Notification.MessagingStyle notification.

ExtraNotificationId

Optional extra for #INTENT_CATEGORY_NOTIFICATION_PREFERENCES.

ExtraNotificationTag

Optional extra for #INTENT_CATEGORY_NOTIFICATION_PREFERENCES.

ExtraPeople

#extras key: A String array containing the people that this notification relates to, each of which was supplied to Builder#addPerson(String).

ExtraPeopleList

#extras key: An arrayList of Person objects containing the people that this notification relates to.

ExtraPicture

#extras key: this is a bitmap to be shown in BigPictureStyle expanded notifications, supplied to BigPictureStyle#bigPicture(android.graphics.Bitmap).

ExtraPictureContentDescription

#extras key: this is a content description of the big picture supplied from BigPictureStyle#bigPicture(Bitmap), supplied to BigPictureStyle#setContentDescription(CharSequence).

ExtraPictureIcon

#extras key: this is an Icon of an image to be shown in BigPictureStyle expanded notifications, supplied to BigPictureStyle#bigPicture(Icon).

ExtraProgress

#extras key: this is the progress value supplied to Builder#setProgress(int, int, boolean).

ExtraProgressIndeterminate

#extras key: whether the progress bar is indeterminate, supplied to Builder#setProgress(int, int, boolean).

ExtraProgressMax

#extras key: this is the maximum value supplied to Builder#setProgress(int, int, boolean).

ExtraRemoteInputDraft

If the notification contained an unsent draft for a RemoteInput when the user clicked on it, we're adding the draft as a String extra to the #contentIntent using this key.

ExtraRemoteInputHistory

#extras key: this is the remote input history, as supplied to Builder#setRemoteInputHistory(CharSequence[]).

ExtraSelfDisplayName

#extras key: the username to be displayed for all messages sent by the user including direct replies android.app.Notification.MessagingStyle notification.

ExtraShowBigPictureWhenCollapsed

#extras key: this is a boolean to indicate that the BigPictureStyle#bigPicture(Bitmap) big picture is to be shown in the collapsed state of a BigPictureStyle notification.

ExtraShowChronometer

#extras key: whether #when should be shown as a count-up timer (specifically a android.widget.Chronometer) instead of a timestamp, as supplied to Builder#setUsesChronometer(boolean).

ExtraShowWhen

#extras key: whether #when should be shown, as supplied to Builder#setShowWhen(boolean).

ExtraSmallIcon

#extras key: this is the resource ID of the notification's main small icon, as supplied to Builder#setSmallIcon(int).

ExtraSubText

#extras key: this is a third line of text, as supplied to Builder#setSubText(CharSequence).

ExtraSummaryText

#extras key: this is a line of summary information intended to be shown alongside expanded notifications, as supplied to (e.

ExtraTemplate

#extras key: A string representing the name of the specific android.app.Notification.Style used to create this notification.

ExtraText

#extras key: this is the main text payload, as supplied to Builder#setContentText(CharSequence).

ExtraTextLines

#extras key: An array of CharSequences to show in InboxStyle expanded notifications, each of which was supplied to InboxStyle#addLine(CharSequence).

ExtraTitle

#extras key: this is the title of the notification, as supplied to Builder#setContentTitle(CharSequence).

ExtraTitleBig

#extras key: this is the title of the notification when shown in expanded form, e.

ExtraVerificationIcon

#extras key: the icon to be displayed as a verification status of the caller on a android.app.Notification.CallStyle notification.

ExtraVerificationText

#extras key: the text to be displayed as a verification status of the caller on a android.app.Notification.CallStyle notification.

ForegroundServiceDefault
Obsolete.

If the Notification associated with starting a foreground service has been built using setForegroundServiceBehavior() with this behavior, display of the notification will usually be suppressed for a short time to avoid visual disturbances to the user.

ForegroundServiceDeferred
Obsolete.

If the Notification associated with starting a foreground service has been built using setForegroundServiceBehavior() with this behavior, display of the notification will usually be suppressed for a short time to avoid visual disturbances to the user.

ForegroundServiceImmediate
Obsolete.

If the Notification associated with starting a foreground service has been built using setForegroundServiceBehavior() with this behavior, display of the notification will be immediate even if the default behavior would be to defer visibility for a short time.

IntentCategoryNotificationPreferences

An activity that provides a user interface for adjusting notification preferences for its containing application.

PriorityDefault

Default notification #priority.

PriorityHigh

Higher #priority, for more important notifications or alerts.

PriorityLow

Lower #priority, for items that are less important.

PriorityMax

Highest #priority, for your application's most important items that require the user's prompt attention or input.

PriorityMin

Lowest #priority; these items might not be shown to the user except under special circumstances, such as detailed notification logs.

Properties

Actions

Array of all Action structures attached to this notification by Builder#addAction(int, CharSequence, PendingIntent).

AllowSystemGeneratedContextualActions

Returns whether the platform is allowed (by the app developer) to generate contextual actions for this notification.

AudioAttributes

The AudioAttributes audio attributes to use when playing the sound.

AudioAttributesDefault

The default value of #audioAttributes.

AudioStreamType
Obsolete.

The audio stream type to use when playing the sound.

BadgeIconType

Returns what icon should be shown for this notification if it is being displayed in a Launcher that supports badging.

BigContentView

A large-format version of #contentView, giving the Notification an opportunity to show more detail.

Category

One of the predefined notification categories (see the CATEGORY_* constants) that best describes this Notification.

ChannelId

Returns the id of the channel this notification posts to.

Class

Returns the runtime class of this Object.

(Inherited from Object)
Color

Accent color (an ARGB integer like the constants in android.graphics.Color) to be applied by the standard Style templates when presenting this notification.

ContentIntent

The intent to execute when the expanded status entry is clicked.

ContentView

The view that will represent this notification in the notification list (which is pulled down from the status bar).

ContextualActions

Returns the actions that are contextual (that is, suggested because of the content of the notification) out of the actions in this notification.

Creator

Parcelable.

Defaults

Specifies which values should be taken from the defaults.

DeleteIntent

The intent to execute when the notification is explicitly dismissed by the user, either with the "Clear All" button or by swiping it away individually.

Extras

Additional semantic data to be carried around with this Notification.

Flags
FullScreenIntent

An intent to launch instead of posting the notification to the status bar.

Group

Get the key used to group this notification into a cluster or stack with other notifications on devices which support such rendering.

GroupAlertBehavior

Returns which type of notifications in a group are responsible for audibly alerting the user.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
HasImage
HeadsUpContentView

A medium-format version of #contentView, providing the Notification an opportunity to add action buttons to contentView.

Icon

The resource id of a drawable to use as the icon in the status bar.

IconLevel

If the icon in the status bar is to have more than one level, you can set this.

JniIdentityHashCode (Inherited from Object)
JniPeerMembers
LargeIcon

A large bitmap to be shown in the notification content area.

LedARGB

The color of the led.

LedOffMS

The number of milliseconds for the LED to be off while it's flashing.

LedOnMS

The number of milliseconds for the LED to be on while it's flashing.

LocusId

Gets the LocusId associated with this notification.

Number

The number of events that this notification represents.

PeerReference (Inherited from Object)
Priority

Relative priority for this notification.

PublicVersion

Replacement version of this notification whose content will be shown in an insecure context such as atop a secure keyguard.

SettingsText
SettingsTextFormatted

Returns the settings text provided to Builder#setSettingsText(CharSequence).

ShortcutId

Returns the ShortcutInfo#getId() id that this notification supersedes, if any.

SmallIcon

The small icon representing this notification in the status bar and content view.

SortKey

Get a sort key that orders this notification among other notifications from the same package.

Sound

The sound to play.

ThresholdClass

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

ThresholdType

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

TickerText

Text that summarizes this notification for accessibility services.

TickerView
Obsolete.

Formerly, a view showing the #tickerText.

TimeoutAfter

Returns the duration from posting after which this notification should be canceled by the system, if it's not canceled already.

Vibrate

The pattern with which to vibrate.

Visibility

Sphere of visibility of this notification, which affects how and when the SystemUI reveals the notification's presence and contents in untrusted situations (namely, on the secure lockscreen).

When

A timestamp related to this notification, in milliseconds since the epoch.

Methods

Clone()

Creates and returns a copy of this Object.

DescribeContents()

Describe the kinds of special objects contained in this Parcelable's marshalled representation.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

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

(Inherited from Object)
FindRemoteInputActionPair(Boolean)

Finds and returns a remote input and its corresponding action.

GetBubbleMetadata()

Returns the bubble metadata that will be used to display app content in a floating window over the existing foreground activity.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetLargeIcon()

The large icon shown in this notification's content view.

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)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetLatestEventInfo(Context, ICharSequence, ICharSequence, PendingIntent)
Obsolete.

Sets the #contentView field to be a view with the standard "Latest Event" layout.

SetLatestEventInfo(Context, String, String, PendingIntent)
Obsolete.

Sets the #contentView field to be a view with the standard "Latest Event" layout.

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)

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, 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)
WriteToParcel(Parcel, ParcelableWriteFlags)

Flatten this notification into a parcel.

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