Notification.Builder Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Builder class for Notification objects.
[Android.Runtime.Register("android/app/Notification$Builder", DoNotGenerateAcw=true)]
public class Notification.Builder : Java.Lang.Object
[<Android.Runtime.Register("android/app/Notification$Builder", DoNotGenerateAcw=true)>]
type Notification.Builder = class
inherit Object
- Inheritance
- Attributes
Remarks
Builder class for Notification objects. Provides a convenient way to set the various fields of a Notification and generate content views using the platform's notification layout template. If your app supports versions of Android as old as API level 4, you can instead use NotificationCompat.Builder, available in the Android Support library. Example:
Android reference for android.app.Notification.Builder.
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
| Name | Description |
|---|---|
| Notification.Builder(Context, String) |
Constructs a new Builder with the defaults: |
| Notification.Builder(Context) |
This constructor is deprecated. |
| Notification.Builder(IntPtr, JniHandleOwnership) |
Initializes a managed representation of an existing Java Native Interface object. |
Properties
| Name | Description |
|---|---|
| Class |
Returns the runtime class of this |
| Extras |
Get the current metadata Bundle used by this notification Builder. |
| Handle |
The handle to the underlying Android instance. (Inherited from Object) |
| JniIdentityHashCode |
Gets the identity hash code assigned to this Java peer by the interop runtime. (Inherited from Object) |
| JniManagedPeerState | (Inherited from JavaObject) |
| JniPeerMembers |
Provides JNI binding infrastructure for Android.App.Notification.Builder. |
| Notification |
Obsolete.
This method was deprecated in API level 16. |
| PeerReference |
Gets the JNI object reference for this Java peer. (Inherited from Object) |
| Style |
Returns the style set by setStyle(Style). |
| ThresholdClass |
Provides JNI binding infrastructure for Android.App.Notification.Builder. |
| ThresholdType |
Provides JNI binding infrastructure for Android.App.Notification.Builder. |
Methods
| Name | Description |
|---|---|
| AddAction(Int32, ICharSequence, PendingIntent) |
This method was deprecated in API level 23. |
| AddAction(Int32, String, PendingIntent) |
This method was deprecated in API level 23. |
| AddAction(Notification+Action) |
Add an action to this notification. |
| AddExtras(Bundle) |
Merge additional metadata into this notification. |
| AddPerson(Person) |
Add a person that is relevant to this notification. |
| AddPerson(String) |
This method was deprecated in API level 28. |
| Build() |
Combine all of the options that have been set and return a new Notification object. |
| Clone() |
Creates and returns a copy of this object. (Inherited from Object) |
| Construct(JniObjectReference, JniObjectReferenceOptions) | (Inherited from JavaObject) |
| CreateBigContentView() |
This method was deprecated in API level 35. |
| CreateContentView() |
This method was deprecated in API level 35. |
| CreateHeadsUpContentView() |
This method was deprecated in API level 35. |
| Dispose() |
Releases the resources held by this Java peer. (Inherited from Object) |
| Dispose(Boolean) |
Releases the resources held by this Java peer. (Inherited from Object) |
| DisposeUnlessReferenced() | (Inherited from JavaObject) |
| Equals(Object) | (Inherited from JavaObject) |
| Equals(Object) |
Indicates whether some other object is "equal to" this one. (Inherited from Object) |
| Extend(Notification+IExtender) |
Apply an extender to this notification builder. |
| GetHashCode() |
Returns a hash code value for the object. (Inherited from Object) |
| 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) |
| RecoverBuilder(Context, Notification) |
Creates a Builder from an existing notification so further changes can be made. |
| SetActions(Notification+Action[]) |
Alter the complete list of actions attached to this notification. |
| SetAllowSystemGeneratedContextualActions(Boolean) |
Determines whether the platform can generate contextual actions for a notification. |
| SetAutoCancel(Boolean) |
Make this notification automatically dismissed when the user touches it. |
| SetBadgeIconType(NotificationBadgeIconType) |
Sets which icon to display as a badge for this notification. |
| SetBubbleMetadata(Notification+BubbleMetadata) |
Sets the BubbleMetadata that will be used to display app content in a floating window over the existing foreground activity. |
| SetCategory(String) |
Set the notification category. |
| SetChannelId(String) |
Specifies the channel the notification should be delivered on. |
| SetChronometerCountDown(Boolean) |
Sets the Chronometer to count down instead of counting up. |
| SetColor(Int32) |
Sets Notification.color. |
| SetColorized(Boolean) |
Set whether this notification should be colorized. |
| SetContent(RemoteViews) |
Supply a custom RemoteViews to use instead of the platform template. |
| SetContentInfo(ICharSequence) |
This method was deprecated in API level 24. |
| SetContentInfo(String) |
This method was deprecated in API level 24. |
| SetContentIntent(PendingIntent) |
Supply a PendingIntent to be sent when the notification is clicked. |
| SetContentText(ICharSequence) |
Set the second line of text in the platform notification template. |
| SetContentText(String) |
Set the second line of text in the platform notification template. |
| SetContentTitle(ICharSequence) |
Set the first line of text in the platform notification template. |
| SetContentTitle(String) |
Set the first line of text in the platform notification template. |
| SetCustomBigContentView(RemoteViews) |
Supply custom RemoteViews to use instead of the platform template in the expanded form. |
| SetCustomContentView(RemoteViews) |
Supply custom RemoteViews to use instead of the platform template. |
| SetCustomHeadsUpContentView(RemoteViews) |
Supply custom RemoteViews to use instead of the platform template in the heads up dialog. |
| SetDefaults(NotificationDefaults) |
This method was deprecated in API level 26. |
| SetDeleteIntent(PendingIntent) |
Supply a PendingIntent to send when the notification is cleared explicitly by the user. |
| SetExtras(Bundle) |
Set metadata for this notification. |
| SetFlag(Int32, Boolean) |
Set the value for a notification flag |
| SetForegroundServiceBehavior(Int32) |
Specify a desired visibility policy for a Notification associated with a foreground service. |
| SetFullScreenIntent(PendingIntent, Boolean) |
An intent to launch instead of posting the notification to the status bar. |
| SetGroup(String) |
Set this notification to be part of a group of notifications sharing the same key. |
| SetGroupAlertBehavior(NotificationGroupAlertBehavior) |
Sets the group alert behavior for this notification. |
| SetGroupSummary(Boolean) |
Set this notification to be the group summary for a group of notifications. |
| SetHandle(IntPtr, JniHandleOwnership) |
Sets the Handle property. (Inherited from Object) |
| SetHasSummarizedContent(Boolean) | |
| SetLargeIcon(Bitmap) |
Add a large icon to the notification content view. |
| SetLargeIcon(Icon) |
Add a large icon to the notification content view. |
| SetLights(Int32, Int32, Int32) |
This method was deprecated in API level 26. |
| SetLocalOnly(Boolean) |
Set whether or not this notification should not bridge to other devices. |
| SetLocusId(LocusId) |
Sets the LocusId associated with this notification. |
| SetNumber(Int32) |
Sets the number of items this notification represents. |
| SetOngoing(Boolean) |
Set whether this is an "ongoing" notification. |
| SetOnlyAlertOnce(Boolean) |
Set this flag if you would only like the sound, vibrate and ticker to be played if the notification is not already showing. |
| SetPeerReference(JniObjectReference, JniObjectReferenceOptions) | (Inherited from JavaObject) |
| SetPriority(Int32) |
This method was deprecated in API level 26. |
| SetProgress(Int32, Int32, Boolean) |
Set the progress this notification represents. |
| SetPublicVersion(Notification) |
Supply a replacement Notification whose contents should be shown in insecure contexts (i.e. |
| SetRemoteInputHistory(ICharSequence[]) |
Set the remote input history. |
| SetRemoteInputHistory(String[]) |
Set the remote input history. |
| SetRequestPromotedOngoing(Boolean) | |
| SetSettingsText(ICharSequence) |
Provides text that will appear as a link to your application's settings. |
| SetSettingsText(String) |
Provides text that will appear as a link to your application's settings. |
| SetShortCriticalText(String) |
Sets a very short string summarizing the most critical information contained in the notification. |
| SetShortcutId(String) |
From Android 11, messaging notifications (those that use MessagingStyle) that use this method to link to a published long-lived sharing shortcut may appear in a dedicated Conversation section of the shade and may show configuration options that are unique to conversations. |
| SetShowWhen(Boolean) |
Control whether the timestamp set with setWhen is shown in the content view. |
| SetSmallIcon(Icon) |
Set the small icon, which will be used to represent the notification in the status bar. |
| SetSmallIcon(Int32, Int32) |
A variant of setSmallIcon(int) that takes an additional level parameter for when the icon is a LevelListDrawable. |
| SetSmallIcon(Int32) |
Set the small icon resource, which will be used to represent the notification in the status bar. |
| SetSortKey(String) |
Set a sort key that orders this notification among other notifications from the same package. |
| SetSound(Uri, AudioAttributes) |
This method was deprecated in API level 26. |
| SetSound(Uri, Stream) |
Obsolete.
This method was deprecated in API level 21. |
| SetSound(Uri) |
This method was deprecated in API level 26. |
| SetStyle(Notification+Style) |
Add a rich notification style to be applied at build time. |
| SetSubText(ICharSequence) |
This provides some additional information that is displayed in the notification. |
| SetSubText(String) |
This provides some additional information that is displayed in the notification. |
| SetTicker(ICharSequence, RemoteViews) |
Obsolete.
Obsolete version of setTicker(CharSequence). |
| SetTicker(ICharSequence) |
Set the "ticker" text which is sent to accessibility services. |
| SetTicker(String, RemoteViews) |
Obsolete.
Obsolete version of setTicker(CharSequence). |
| SetTicker(String) |
Set the "ticker" text which is sent to accessibility services. |
| SetTimeoutAfter(Int64) |
Specifies a duration in milliseconds after which this notification should be canceled, if it is not already canceled. |
| SetUsesChronometer(Boolean) |
Show the Notification.when field as a stopwatch. |
| SetVibrate(Int64[]) |
This method was deprecated in API level 26. |
| SetVisibility(NotificationVisibility) |
Specify the value of Notification.visibility. |
| SetWhen(Int64) |
Add a timestamp pertaining to the notification (usually the time the event occurred). |
| ToArray<T>() |
Creates a managed array from this Java array wrapper. (Inherited from Object) |
| ToString() |
Returns a string representation of the object. (Inherited from Object) |
| UnregisterFromRuntime() |
Unregisters this Java peer from the interop runtime. (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) |
Explicit Interface Implementations
| Name | Description |
|---|---|
| IJavaPeerable.Disposed() | (Inherited from JavaObject) |
| IJavaPeerable.Finalized() | (Inherited from JavaObject) |
| IJavaPeerable.JniObjectReferenceControlBlock | (Inherited from JavaObject) |
| IJavaPeerable.SetJniIdentityHashCode(Int32) | (Inherited from JavaObject) |
| IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from JavaObject) |
| IJavaPeerable.SetPeerReference(JniObjectReference) | (Inherited from JavaObject) |
Extension Methods
| Name | Description |
|---|---|
| GetJniTypeName(IJavaPeerable) |
Gets the JNI name of the type of the instance |
| JavaAs<TResult>(IJavaPeerable) |
Try to coerce |
| JavaCast<TResult>(IJavaObject) |
Performs an Android runtime-checked type conversion. |
| JavaCast<TResult>(IJavaObject) | |
| TryJavaCast<TResult>(IJavaPeerable, TResult) |
Try to coerce |