Aracılığıyla paylaş


Notification.Builder Class

Definition

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
Notification.Builder
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 androidx.core.app.NotificationCompat.Builder NotificationCompat.Builder, available in the Android Support library.

Example:

Notification noti = new Notification.Builder(mContext)
                    .setContentTitle(&quot;New mail from &quot; + sender.toString())
                    .setContentText(subject)
                    .setSmallIcon(R.drawable.new_mail)
                    .setLargeIcon(aBitmap)
                    .build();

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

Notification.Builder(Context, String)

Constructs a new Builder with the defaults:

Notification.Builder(Context)

This member is deprecated.

Notification.Builder(IntPtr, JniHandleOwnership)

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

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Extras

Get the current metadata Bundle used by this notification Builder.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
Notification
Obsolete.

This member is deprecated.

PeerReference (Inherited from Object)
Style
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.

Methods

AddAction(Int32, ICharSequence, PendingIntent)

Add an action (with a corresponding title and intent) to this notification.

AddAction(Int32, String, PendingIntent)

Add an action (with a corresponding title and intent) to this notification.

AddAction(Notification+Action)

Add an action to this notification.

AddExtras(Bundle)

Merge additional metadata into this notification.

AddPerson(Person)
AddPerson(String)

Add a person that is relevant to this notification.

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)
CreateBigContentView()

Construct a RemoteViews for the final big notification layout.

CreateContentView()

Construct a RemoteViews for the final 1U notification layout.

CreateHeadsUpContentView()

Construct a RemoteViews for the final heads-up notification layout.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
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)
SetActions(Notification+Action[])
SetAllowSystemGeneratedContextualActions(Boolean)
SetAutoCancel(Boolean)

Make this notification automatically dismissed when the user touches it.

SetBadgeIconType(NotificationBadgeIconType)
SetBubbleMetadata(Notification+BubbleMetadata)
SetCategory(String)

Set the notification category.

SetChannelId(String)
SetChronometerCountDown(Boolean)
SetColor(Int32)

Set the accent color of the notification.

SetColorized(Boolean)
SetContent(RemoteViews)

Supply a custom RemoteViews object to use instead of the platform template.

SetContentInfo(ICharSequence)

Add a small piece of additional information pertaining to this notification.

SetContentInfo(String)

Add a small piece of additional information pertaining to this notification.

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)
SetCustomContentView(RemoteViews)
SetCustomHeadsUpContentView(RemoteViews)
SetDefaults(NotificationDefaults)

Set which notification properties will be inherited from system defaults.

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)
SetForegroundServiceBehavior(Int32)
SetFullScreenIntent(PendingIntent, Boolean)

Specifies 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)
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)
SetLargeIcon(Bitmap)

Add a large icon to the notification (and the ticker on some devices).

SetLargeIcon(Icon)
SetLights(Int32, Int32, Int32)

Set the desired color for the indicator LED on the device, as well as the blink duty cycle (specified in milliseconds).

SetLocalOnly(Boolean)

Set whether or not this notification should not bridge to other devices.

SetLocusId(LocusId)
SetNumber(Int32)

Set the large number at the right-hand side of the notification.

SetOngoing(Boolean)

Set whether this is an "ongoing" notification.

SetOnlyAlertOnce(Boolean)

Play sound, vibrate and ticker only if the notification is not already showing.

SetPriority(Int32)

Set the priority of this notification.

SetProgress(Int32, Int32, Boolean)

Set the progress that this notification represents.

SetPublicVersion(Notification)

Supply a public version of the notification.

SetRemoteInputHistory(ICharSequence[])
SetRemoteInputHistory(String[])
SetSettingsText(ICharSequence)
SetSettingsText(String)
SetShortcutId(String)
SetShowWhen(Boolean)

Control whether the timestamp is shown in the content view.

SetSmallIcon(Icon)
SetSmallIcon(Int32, Int32)

Set the small icon resource for the specified level.

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)

Set the alert sound to play, along with sound attributes to use during playback.

SetSound(Uri, Stream)
Obsolete.

Set the sound to play, along with a specific stream on which to play it.

SetSound(Uri)

Set the alert sound to play.

SetStyle(Notification+Style)

Add a rich notification style to be applied at build time.

SetSubText(ICharSequence)

Set the third line of text in the platform notification template.

SetSubText(String)

Set the third line of text in the platform notification template.

SetTicker(ICharSequence, RemoteViews)
Obsolete.

Set the ticker text and associated RemoteViews.

SetTicker(ICharSequence)

Set the "ticker" text which is displayed in the status bar when the notification first arrives.

SetTicker(String, RemoteViews)
Obsolete.

Set the ticker text.

SetTicker(String)

Set the "ticker" text which is displayed in the status bar when the notification first arrives.

SetTimeoutAfter(Int64)
SetUsesChronometer(Boolean)

Show the When field as a stopwatch.

SetVibrate(Int64[])

Set the alert vibration pattern to use.

SetVisibility(NotificationVisibility)

Specify the visibility of the notification contents.

SetWhen(Int64)

Add a timestamp pertaining to the notification (usually the time the event occurred).

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)

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