Builder
open class Builder
kotlin.Any | |
↳ | androidx.core.app.NotificationCompat.Builder |
Builder class for NotificationCompat
objects. Allows easier control over all the flags, as well as help constructing the typical notification layouts.
On platform versions that don't offer expanded notifications, methods that depend on expanded notifications have no effect.
For example, action buttons won't appear on platforms prior to Android 4.1. Action buttons depend on expanded notifications, which are only available in Android 4.1 and later.
For this reason, you should always ensure that UI controls in a notification are also available in an android.app.Activity
in your app, and you should always start that android.app.Activity
when users click the notification. To do this, use the setContentIntent()
method.
Summary
Public constructors | |
---|---|
<init>(@NonNull context: Context, @NonNull notification: Notification) Creates a NotificationCompat. |
|
Constructor. |
|
Public methods | |
---|---|
open NotificationCompat.Builder |
addAction(icon: Int, @Nullable title: CharSequence?, @Nullable intent: PendingIntent?) Add an action to this notification. |
open NotificationCompat.Builder |
addAction(@Nullable action: NotificationCompat.Action?) Add an action to this notification. |
open NotificationCompat.Builder |
Merge additional metadata into this notification. |
open NotificationCompat.Builder |
addInvisibleAction(icon: Int, @Nullable title: CharSequence?, @Nullable intent: PendingIntent?) Add an invisible action to this notification. |
open NotificationCompat.Builder |
addInvisibleAction(@Nullable action: NotificationCompat.Action?) Add an invisible action to this notification. |
open NotificationCompat.Builder |
Add a person that is relevant to this notification. |
open NotificationCompat.Builder |
Add a person that is relevant to this notification. |
open Notification |
build() Combine all of the options that have been set and return a new |
open NotificationCompat.Builder |
Clear any actions added via #addAction |
open NotificationCompat.Builder |
Clear any invisible actions added via #addInvisibleAction |
open NotificationCompat.Builder |
Clear any people added via either |
open RemoteViews? |
Construct a RemoteViews for the final big notification layout. |
open RemoteViews? |
Construct a RemoteViews for the final notification layout. |
open RemoteViews? |
Construct a RemoteViews for the final heads-up notification layout. |
open NotificationCompat.Builder |
extend(@NonNull extender: NotificationCompat.Extender) Apply an extender to this notification builder. |
open Bundle |
Get the current metadata Bundle used by this notification Builder. |
open Notification | |
open NotificationCompat.Builder |
Determines whether the platform can generate contextual actions for a notification. |
open NotificationCompat.Builder |
setAutoCancel(autoCancel: Boolean) Setting this flag will make it so the notification is automatically canceled when the user clicks it in the panel. |
open NotificationCompat.Builder |
setBadgeIconType(icon: Int) Sets which icon to display as a badge for this notification. |
open NotificationCompat.Builder |
setBubbleMetadata(@Nullable data: NotificationCompat.BubbleMetadata?) Sets the |
open NotificationCompat.Builder |
setCategory(@Nullable category: String?) Set the notification category. |
open NotificationCompat.Builder |
setChannelId(@NonNull channelId: String) Specifies the channel the notification should be delivered on. |
open NotificationCompat.Builder |
setChronometerCountDown(countsDown: Boolean) Sets the Chronometer to count down instead of counting up. |
open NotificationCompat.Builder |
Sets |
open NotificationCompat.Builder |
setColorized(colorize: Boolean) Set whether this notification should be colorized. |
open NotificationCompat.Builder |
setContent(@Nullable views: RemoteViews?) Supply a custom RemoteViews to use instead of the standard one. |
open NotificationCompat.Builder |
setContentInfo(@Nullable info: CharSequence?) A small piece of additional information pertaining to this notification. |
open NotificationCompat.Builder |
setContentIntent(@Nullable intent: PendingIntent?) Supply a |
open NotificationCompat.Builder |
setContentText(@Nullable text: CharSequence?) Set the text (second row) of the notification, in a standard notification. |
open NotificationCompat.Builder |
setContentTitle(@Nullable title: CharSequence?) Set the title (first row) of the notification, in a standard notification. |
open NotificationCompat.Builder |
setCustomBigContentView(@Nullable contentView: RemoteViews?) Supply custom RemoteViews to use instead of the platform template in the expanded form. |
open NotificationCompat.Builder |
setCustomContentView(@Nullable contentView: RemoteViews?) Supply custom RemoteViews to use instead of the platform template. |
open NotificationCompat.Builder |
setCustomHeadsUpContentView(@Nullable contentView: RemoteViews?) Supply custom RemoteViews to use instead of the platform template in the heads up dialog. |
open NotificationCompat.Builder |
setDefaults(defaults: Int) Set the default notification options that will be used. |
open NotificationCompat.Builder |
setDeleteIntent(@Nullable intent: PendingIntent?) Supply a |
open NotificationCompat.Builder |
Set metadata for this notification. |
open NotificationCompat.Builder |
setFullScreenIntent(@Nullable intent: PendingIntent?, highPriority: Boolean) An intent to launch instead of posting the notification to the status bar. |
open NotificationCompat.Builder |
Set this notification to be part of a group of notifications sharing the same key. |
open NotificationCompat.Builder |
setGroupAlertBehavior(groupAlertBehavior: Int) Sets the group alert behavior for this notification. |
open NotificationCompat.Builder |
setGroupSummary(isGroupSummary: Boolean) Set this notification to be the group summary for a group of notifications. |
open NotificationCompat.Builder |
setLargeIcon(@Nullable icon: Bitmap?) Set the large icon that is shown in the notification. |
open NotificationCompat.Builder |
Set the argb value that you would like the LED on the device to blink, as well as the rate. |
open NotificationCompat.Builder |
setLocalOnly(b: Boolean) Set whether or not this notification is only relevant to the current device. |
open NotificationCompat.Builder |
setLocusId(@Nullable locusId: LocusIdCompat?) Sets the |
open NotificationCompat.Builder |
Silences this instance of the notification, regardless of the sounds or vibrations set on the notification or notification channel. |
open NotificationCompat.Builder |
Sets the number of items this notification represents. |
open NotificationCompat.Builder |
setOngoing(ongoing: Boolean) Set whether this is an ongoing notification. |
open NotificationCompat.Builder |