# NotificationCompat.Builder

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/app/NotificationCompat.java+class:androidx.core.app.NotificationCompat.Builder) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

*** ** * ** ***

<br />

```
class NotificationCompat.Builder
```

<br />

*** ** * ** ***

Builder class for `https://developer.android.com/reference/kotlin/androidx/core/app/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 `https://developer.android.com/reference/android/app/Activity.html` in your app, and you should always start that `https://developer.android.com/reference/android/app/Activity.html` when users click the notification. To do this, use the `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setContentIntent(android.app.PendingIntent)` method.

## Summary

| ### Public constructors |
|---|
| `[Builder](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#Builder(android.content.Context))(context: https://developer.android.com/reference/android/content/Context.html)` **This function is deprecated.** use `Builder(Context, String)` instead. <br /> |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#Builder(android.content.Context,java.lang.String)(context: https://developer.android.com/reference/android/content/Context.html, channelId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Constructor. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#Builder(android.content.Context,android.app.Notification)(context: https://developer.android.com/reference/android/content/Context.html, notification: https://developer.android.com/reference/android/app/Notification.html)` Creates a NotificationCompat.Builder which can be used to build a notification that is equivalent to the given one, such that updates can be made to an existing notification with the NotificationCompat.Builder API. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#addAction(androidx.core.app.NotificationCompat.Action)(action: https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Action?)` Add an action to this notification. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#addAction(int,java.lang.CharSequence,android.app.PendingIntent)(icon: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, title: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?, intent: https://developer.android.com/reference/android/app/PendingIntent.html?)` Add an action to this notification. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#addExtras(android.os.Bundle)(extras: https://developer.android.com/reference/android/os/Bundle.html?)` Merge additional metadata into this notification. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#addInvisibleAction(androidx.core.app.NotificationCompat.Action)(action: https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Action?)` Add an invisible action to this notification. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#addInvisibleAction(int,java.lang.CharSequence,android.app.PendingIntent)(icon: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, title: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?, intent: https://developer.android.com/reference/android/app/PendingIntent.html?)` Add an invisible action to this notification. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#addPerson(androidx.core.app.Person)(person: https://developer.android.com/reference/kotlin/androidx/core/app/Person?)` Add a person that is relevant to this notification. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `[addPerson](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#addPerson(java.lang.String))(uri: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?)` **This function is deprecated.** use `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#addPerson(androidx.core.app.Person)` <br /> |
| `https://developer.android.com/reference/android/app/Notification.html` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#build()()` Combine all of the options that have been set and return a new `https://developer.android.com/reference/android/app/Notification.html` object. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#clearActions()()` Clear any actions added via `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#addAction(int,java.lang.CharSequence,android.app.PendingIntent)` |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#clearInvisibleActions()()` Clear any invisible actions added via `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#addInvisibleAction(int,java.lang.CharSequence,android.app.PendingIntent)` |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#clearPeople()()` Clear any people added via either `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#addPerson(androidx.core.app.Person)` or `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#addPerson(java.lang.String)` |
| `https://developer.android.com/reference/android/widget/RemoteViews.html?` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#createBigContentView()()` Construct a RemoteViews for the final big notification layout. |
| `https://developer.android.com/reference/android/widget/RemoteViews.html?` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#createContentView()()` Construct a RemoteViews for the final notification layout. |
| `https://developer.android.com/reference/android/widget/RemoteViews.html?` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#createHeadsUpContentView()()` Construct a RemoteViews for the final heads-up notification layout. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#extend(androidx.core.app.NotificationCompat.Extender)(extender: https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Extender)` Apply an extender to this notification builder. |
| `https://developer.android.com/reference/android/os/Bundle.html` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#getExtras()()` Get the current metadata Bundle used by this notification Builder. |
| `https://developer.android.com/reference/android/app/Notification.html` | `[getNotification](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#getNotification())()` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#build()` instead. <br /> |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setAllowSystemGeneratedContextualActions(boolean)(allowed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Determines whether the platform can generate contextual actions for a notification. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setAutoCancel(boolean)(autoCancel: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Setting this flag will make it so the notification is automatically canceled when the user clicks it in the panel. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setBadgeIconType(int)(icon: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Sets which icon to display as a badge for this notification. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setBubbleMetadata(androidx.core.app.NotificationCompat.BubbleMetadata)(data: https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.BubbleMetadata?)` Sets the `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.BubbleMetadata` that will be used to display app content in a floating window over the existing foreground activity. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setCategory(java.lang.String)(category: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?)` Set the notification category. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setChannelId(java.lang.String)(channelId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Specifies the channel the notification should be delivered on. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 24) https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setChronometerCountDown(boolean)(countsDown: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Sets the Chronometer to count down instead of counting up. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setColor(int)(argb: @https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Sets `https://developer.android.com/reference/android/app/Notification.html#color`. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setColorized(boolean)(colorize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Set whether this notification should be colorized. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setContent(android.widget.RemoteViews)(views: https://developer.android.com/reference/android/widget/RemoteViews.html?)` Supply a custom RemoteViews to use instead of the standard one. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setContentInfo(java.lang.CharSequence)(info: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?)` A small piece of additional information pertaining to this notification. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setContentIntent(android.app.PendingIntent)(intent: https://developer.android.com/reference/android/app/PendingIntent.html?)` Supply a `https://developer.android.com/reference/android/app/PendingIntent.html` to send when the notification is clicked. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setContentText(java.lang.CharSequence)(text: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?)` Set the text (second row) of the notification, in a standard notification. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setContentTitle(java.lang.CharSequence)(title: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?)` Set the title (first row) of the notification, in a standard notification. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setCustomBigContentView(android.widget.RemoteViews)(contentView: https://developer.android.com/reference/android/widget/RemoteViews.html?)` Supply custom RemoteViews to use instead of the platform template in the expanded form. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setCustomContentView(android.widget.RemoteViews)(contentView: https://developer.android.com/reference/android/widget/RemoteViews.html?)` Supply custom RemoteViews to use instead of the platform template. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setCustomHeadsUpContentView(android.widget.RemoteViews)(contentView: https://developer.android.com/reference/android/widget/RemoteViews.html?)` Supply custom RemoteViews to use instead of the platform template in the heads up dialog. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setDefaults(int)(defaults: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Set the default notification options that will be used. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setDeleteIntent(android.app.PendingIntent)(intent: https://developer.android.com/reference/android/app/PendingIntent.html?)` Supply a `https://developer.android.com/reference/android/app/PendingIntent.html` to send when the notification is cleared by the user directly from the notification panel. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setExtras(android.os.Bundle)(extras: https://developer.android.com/reference/android/os/Bundle.html?)` Set metadata for this notification. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setForegroundServiceBehavior(int)(behavior: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Specify a desired visibility policy for a Notification associated with a foreground service. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setFullScreenIntent(android.app.PendingIntent,boolean)(intent: https://developer.android.com/reference/android/app/PendingIntent.html?, highPriority: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` An intent to launch instead of posting the notification to the status bar. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setGroup(java.lang.String)(groupKey: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?)` Set this notification to be part of a group of notifications sharing the same key. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setGroupAlertBehavior(int)(groupAlertBehavior: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Sets the group alert behavior for this notification. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setGroupSummary(boolean)(isGroupSummary: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Set this notification to be the group summary for a group of notifications. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setLargeIcon(android.graphics.Bitmap)(icon: https://developer.android.com/reference/android/graphics/Bitmap.html?)` Sets the large icon that is shown in the notification. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setLargeIcon(android.graphics.drawable.Icon)(icon: https://developer.android.com/reference/android/graphics/drawable/Icon.html?)` Sets the large icon that is shown in the notification. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setLights(int,int,int)(argb: @https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, onMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, offMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Set the argb value that you would like the LED on the device to blink, as well as the rate. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setLocalOnly(boolean)(b: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Set whether or not this notification is only relevant to the current device. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setLocusId(androidx.core.content.LocusIdCompat)(locusId: https://developer.android.com/reference/kotlin/androidx/core/content/LocusIdCompat?)` Sets the `https://developer.android.com/reference/kotlin/androidx/core/content/LocusIdCompat` associated with this notification. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `[setNotificationSilent](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setNotificationSilent())()` **This function is deprecated.** use `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setSilent(boolean)` <br /> |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setNumber(int)(number: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Sets the number of items this notification represents. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setOngoing(boolean)(ongoing: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Set whether this is an ongoing notification. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setOnlyAlertOnce(boolean)(onlyAlertOnce: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Set this flag if you would only like the sound, vibrate and ticker to be played if the notification is not already showing. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setPriority(int)(pri: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Set the relative priority for this notification. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setProgress(int,int,boolean)(max: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, progress: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, indeterminate: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Set the progress this notification represents, which may be represented as a `https://developer.android.com/reference/android/widget/ProgressBar.html`. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setPublicVersion(android.app.Notification)(n: https://developer.android.com/reference/android/app/Notification.html?)` Supply a replacement Notification whose contents should be shown in insecure contexts (i.e. atop the secure lockscreen). |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setRemoteInputHistory(java.lang.CharSequence[])(text: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html!>?)` Set the remote input history. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setRequestPromotedOngoing(boolean)(requestPromotedOngoing: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Set whether this notification is requesting to be a promoted ongoing notification. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setSettingsText(java.lang.CharSequence)(text: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?)` Provides text that will appear as a link to your application's settings. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setShortCriticalText(java.lang.String)(shortCriticalText: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?)` Sets a very short string summarizing the most critical information contained in the notification. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setShortcutId(java.lang.String)(shortcutId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?)` From Android 11, messaging notifications (those that use `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.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. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setShortcutInfo(androidx.core.content.pm.ShortcutInfoCompat)(shortcutInfo: https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat?)` Populates this notification with given `https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat`. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setShowWhen(boolean)(show: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Control whether the timestamp set with `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setWhen(long)` is shown in the content view. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setSilent(boolean)(silent: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` If `true`, silences this instance of the notification and prevents the notification from peeking on screen, regardless of the importance, sounds, or vibrations set on the notification or notification channel. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setSmallIcon(androidx.core.graphics.drawable.IconCompat)(icon: https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat)` Set the small icon to use in the notification layouts. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setSmallIcon(int)(icon: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Set the small icon to use in the notification layouts. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setSmallIcon(int,int)(icon: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, level: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` A variant of `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setSmallIcon(int)` that takes an additional level parameter for when the icon is a `https://developer.android.com/reference/android/graphics/drawable/LevelListDrawable.html`. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setSortKey(java.lang.String)(sortKey: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?)` Set a sort key that orders this notification among other notifications from the same package. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setSound(android.net.Uri)(sound: https://developer.android.com/reference/android/net/Uri.html?)` Set the sound to play. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setSound(android.net.Uri,int)(sound: https://developer.android.com/reference/android/net/Uri.html?, streamType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Set the sound to play. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setStyle(androidx.core.app.NotificationCompat.Style)(style: https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Style?)` Add a rich notification style to be applied at build time. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setSubText(java.lang.CharSequence)(text: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?)` This provides some additional information that is displayed in the notification. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setTicker(java.lang.CharSequence)(tickerText: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?)` Sets the "ticker" text which is sent to accessibility services. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `[setTicker](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setTicker(java.lang.CharSequence,android.widget.RemoteViews))(tickerText: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?, views: https://developer.android.com/reference/android/widget/RemoteViews.html?)` **This function is deprecated.** use `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setTicker(java.lang.CharSequence)` <br /> |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setTimeoutAfter(long)(durationMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Specifies the time at which this notification should be canceled, if it is not already canceled. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setUsesChronometer(boolean)(b: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Show the `https://developer.android.com/reference/android/app/Notification.html#when` field as a stopwatch. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setVibrate(long[])(pattern: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html>?)` Set the vibration pattern to use. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setVisibility(int)(visibility: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Sets `https://developer.android.com/reference/android/app/Notification.html#visibility`. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setWhen(long)(when: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Set the time that the event occurred. |

| ### Protected functions |
|---|---|
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#limitCharSequenceLength(java.lang.CharSequence)(cs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?)` |

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/java/util/ArrayList.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>!` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#mPeople()` **This property is deprecated.** This field was not meant to be public. <br /> |

## Public constructors

### Builder

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
[Builder](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#Builder(android.content.Context))(context: Context)
```

> [!CAUTION]
> **This function is deprecated.**   
>
> use `Builder(Context, String)` instead. All posted notifications must specify a NotificationChannel ID.

### Builder

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
Builder(context: Context, channelId: String)
```

Constructor. Automatically sets the when field to `https://developer.android.com/reference/java/lang/System.html#currentTimeMillis()` and the audio stream to the `https://developer.android.com/reference/android/app/Notification.html#STREAM_DEFAULT`.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | A `https://developer.android.com/reference/android/content/Context.html` that will be used to construct the RemoteViews. The Context will not be held past the lifetime of this Builder object. |
| `channelId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The constructed Notification will be posted on this NotificationChannel. |

### Builder

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
Builder(context: Context, notification: Notification)
```

Creates a NotificationCompat.Builder which can be used to build a notification that is equivalent to the given one, such that updates can be made to an existing notification with the NotificationCompat.Builder API.

## Public functions

### addAction

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun addAction(action: NotificationCompat.Action?): NotificationCompat.Builder
```

Add an action to this notification. Actions are typically displayed by the system as a button adjacent to the notification content. 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. To ensure that an action button's functionality is always available, first implement the functionality in the `https://developer.android.com/reference/android/app/Activity.html` that starts when a user clicks the notification (see `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setContentIntent(android.app.PendingIntent)`), and then enhance the notification by implementing the same functionality with `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#addAction(int,java.lang.CharSequence,android.app.PendingIntent)`.

| Parameters |
|---|---|
| `action: https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Action?` | The action to add. |

### addAction

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun addAction(icon: Int, title: CharSequence?, intent: PendingIntent?): NotificationCompat.Builder
```

Add an action to this notification. Actions are typically displayed by the system as a button adjacent to the notification content. 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. To ensure that an action button's functionality is always available, first implement the functionality in the `https://developer.android.com/reference/android/app/Activity.html` that starts when a user clicks the notification (see `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setContentIntent(android.app.PendingIntent)`), and then enhance the notification by implementing the same functionality with `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#addAction(int,java.lang.CharSequence,android.app.PendingIntent)`.

| Parameters |
|---|---|
| `icon: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Resource ID of a drawable that represents the action. |
| `title: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?` | Text describing the action. |
| `intent: https://developer.android.com/reference/android/app/PendingIntent.html?` | `https://developer.android.com/reference/android/app/PendingIntent.html` to be fired when the action is invoked. |

### addExtras

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun addExtras(extras: Bundle?): NotificationCompat.Builder
```

Merge additional metadata into this notification.

Values within the Bundle will replace existing extras values in this Builder.

| See also |
|---|---|
| `https://developer.android.com/reference/android/app/Notification.html#extras` |   |

### addInvisibleAction

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun addInvisibleAction(action: NotificationCompat.Action?): NotificationCompat.Builder
```

Add an invisible action to this notification. Invisible actions are never displayed by the system, but can be retrieved and used by other application listening to system notifications. Invisible actions are supported from Android 4.4.4 (API 20) and can be retrieved using `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat#getInvisibleActions(android.app.Notification)`.

| Parameters |
|---|---|
| `action: https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Action?` | The action to add. |

### addInvisibleAction

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun addInvisibleAction(icon: Int, title: CharSequence?, intent: PendingIntent?): NotificationCompat.Builder
```

Add an invisible action to this notification. Invisible actions are never displayed by the system, but can be retrieved and used by other application listening to system notifications. Invisible actions are supported from Android 4.4.4 (API 20) and can be retrieved using `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat#getInvisibleActions(android.app.Notification)`.

| Parameters |
|---|---|
| `icon: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Resource ID of a drawable that represents the action. |
| `title: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?` | Text describing the action. |
| `intent: https://developer.android.com/reference/android/app/PendingIntent.html?` | `https://developer.android.com/reference/android/app/PendingIntent.html` to be fired when the action is invoked. |

### addPerson

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun addPerson(person: Person?): NotificationCompat.Builder
```

Add a person that is relevant to this notification.

Depending on user preferences, this annotation may allow the notification to pass through interruption filters, if this notification is of category `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat#CATEGORY_CALL()` or `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat#CATEGORY_MESSAGE()`. The addition of people may also cause this notification to appear more prominently in the user interface.

A person should usually contain a uri in order to benefit from the ranking boost. However, even if no uri is provided, it's beneficial to provide other people in the notification, such that listeners and voice only devices can announce and handle them properly.

| Parameters |
|---|---|
| `person: https://developer.android.com/reference/kotlin/androidx/core/app/Person?` | the person to add. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat#EXTRA_PEOPLE_LIST()` |   |

### addPerson

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0) Deprecated in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun [addPerson](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#addPerson(java.lang.String))(uri: String?): NotificationCompat.Builder
```

> [!CAUTION]
> **This function is deprecated.**   
>
> use `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#addPerson(androidx.core.app.Person)`

Add a person that is relevant to this notification.

Depending on user preferences, this annotation may allow the notification to pass through interruption filters, and to appear more prominently in the user interface.

The person should be specified by the `String` representation of a `https://developer.android.com/reference/android/provider/ContactsContract.Contacts.html#CONTENT_LOOKUP_URI`.

The system will also attempt to resolve `mailto:` and `tel:` schema URIs. The path part of these URIs must exist in the contacts database, in the appropriate column, or the reference will be discarded as invalid. Telephone schema URIs will be resolved by `https://developer.android.com/reference/android/provider/ContactsContract.PhoneLookup.html`.

| Parameters |
|---|---|
| `uri: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | A URI for the person. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/app/Notification.html#EXTRA_PEOPLE` |   |

### build

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun build(): Notification
```

Combine all of the options that have been set and return a new `https://developer.android.com/reference/android/app/Notification.html` object.

### clearActions

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun clearActions(): NotificationCompat.Builder
```

Clear any actions added via `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#addAction(int,java.lang.CharSequence,android.app.PendingIntent)`

### clearInvisibleActions

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun clearInvisibleActions(): NotificationCompat.Builder
```

Clear any invisible actions added via `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#addInvisibleAction(int,java.lang.CharSequence,android.app.PendingIntent)`

### clearPeople

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun clearPeople(): NotificationCompat.Builder
```

Clear any people added via either `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#addPerson(androidx.core.app.Person)` or `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#addPerson(java.lang.String)`

### createBigContentView

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun createBigContentView(): RemoteViews?
```

Construct a RemoteViews for the final big notification layout.

### createContentView

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun createContentView(): RemoteViews?
```

Construct a RemoteViews for the final notification layout.

### createHeadsUpContentView

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun createHeadsUpContentView(): RemoteViews?
```

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

### extend

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun extend(extender: NotificationCompat.Extender): NotificationCompat.Builder
```

Apply an extender to this notification builder. Extenders may be used to add metadata or change options on this builder.

### getExtras

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun getExtras(): Bundle
```

Get the current metadata Bundle used by this notification Builder.

The returned Bundle is shared with this Builder.

The current contents of this Bundle are copied into the Notification each time `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#build()` is called.

| See also |
|---|---|
| `https://developer.android.com/reference/android/app/Notification.html#extras` |   |

### getNotification

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun [getNotification](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#getNotification())(): Notification
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#build()` instead.

### setAllowSystemGeneratedContextualActions

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/core#1.2.0)

```
fun setAllowSystemGeneratedContextualActions(allowed: Boolean): NotificationCompat.Builder
```

Determines whether the platform can generate contextual actions for a notification. By default this is true.

### setAutoCancel

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setAutoCancel(autoCancel: Boolean): NotificationCompat.Builder
```

Setting this flag will make it so the notification is automatically canceled when the user clicks it in the panel.

### setBadgeIconType

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setBadgeIconType(icon: Int): NotificationCompat.Builder
```

Sets which icon to display as a badge for this notification.

Must be one of `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat#BADGE_ICON_NONE()`, `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat#BADGE_ICON_SMALL()`, `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat#BADGE_ICON_LARGE()`.

**Note:** This value might be ignored, for launchers that don't support badge icons.

### setBubbleMetadata

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/core#1.2.0)

```
fun setBubbleMetadata(data: NotificationCompat.BubbleMetadata?): NotificationCompat.Builder
```

Sets the `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.BubbleMetadata` that will be used to display app content in a floating window over the existing foreground activity.

This data will be ignored unless the notification is posted to a channel that allows `https://developer.android.com/reference/android/app/NotificationChannel.html#canBubble()`.

Notifications allowed to bubble that have valid bubble metadata will display in collapsed state outside of the notification shade on unlocked devices. When a user interacts with the collapsed state, the bubble intent will be invoked and displayed.

### setCategory

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setCategory(category: String?): NotificationCompat.Builder
```

Set the notification category.

Must be one of the predefined notification categories (see the `CATEGORY_*` constants in `https://developer.android.com/reference/android/app/Notification.html`) that best describes this notification. May be used by the system for ranking and filtering.

### setChannelId

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setChannelId(channelId: String): NotificationCompat.Builder
```

Specifies the channel the notification should be delivered on. No-op on versions prior to `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#O`.

### setChronometerCountDown

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/core#1.2.0)

```
@RequiresApi(value = 24)
fun setChronometerCountDown(countsDown: Boolean): NotificationCompat.Builder
```

Sets the Chronometer to count down instead of counting up. This is only relevant if setUsesChronometer(boolean) has been set to true. If it isn't set the chronometer will count up.

| See also |
|---|---|
| `https://developer.android.com/reference/android/widget/Chronometer.html` |   |

### setColor

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setColor(argb: @ColorInt Int): NotificationCompat.Builder
```

Sets `https://developer.android.com/reference/android/app/Notification.html#color`.

| Parameters |
|---|---|
| `argb: @https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The accent color to use |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | The same Builder. |

### setColorized

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setColorized(colorize: Boolean): NotificationCompat.Builder
```

Set whether this notification should be colorized. When set, the color set with `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setColor(int)` will be used as the background color of this notification.

This should only be used for high priority ongoing tasks like navigation, an ongoing call, or other similarly high-priority events for the user.

For most styles, the coloring will only be applied if the notification is for a foreground service notification.

However, for MediaStyle and DecoratedMediaCustomViewStyle notifications that have a media session attached there is no such requirement.

Calling this method on any version prior to `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#O` will not have an effect on the notification and it won't be colorized.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setColor(int)` |   |

### setContent

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setContent(views: RemoteViews?): NotificationCompat.Builder
```

Supply a custom RemoteViews to use instead of the standard one.

### setContentInfo

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setContentInfo(info: CharSequence?): NotificationCompat.Builder
```

A small piece of additional information pertaining to this notification. Where this text is displayed varies between platform versions. Use `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setSubText(java.lang.CharSequence)` instead to set a text in the header. For legacy apps targeting a version below `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#N` this field will still show up, but the subtext will take precedence.

### setContentIntent

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setContentIntent(intent: PendingIntent?): NotificationCompat.Builder
```

Supply a `https://developer.android.com/reference/android/app/PendingIntent.html` to send when the notification is clicked. If you do not supply an intent, you can now add PendingIntents to individual views to be launched when clicked by calling `https://developer.android.com/reference/android/widget/RemoteViews.html#setOnClickPendingIntent(int, android.app.PendingIntent)`. Be sure to read `https://developer.android.com/reference/android/app/Notification.html#contentIntent` for how to correctly use this.

### setContentText

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setContentText(text: CharSequence?): NotificationCompat.Builder
```

Set the text (second row) of the notification, in a standard notification.

### setContentTitle

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setContentTitle(title: CharSequence?): NotificationCompat.Builder
```

Set the title (first row) of the notification, in a standard notification.

### setCustomBigContentView

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setCustomBigContentView(contentView: RemoteViews?): NotificationCompat.Builder
```

Supply custom RemoteViews to use instead of the platform template in the expanded form. This will override the expanded layout that would otherwise be constructed by this Builder object. No-op on versions prior to `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#JELLY_BEAN`.

### setCustomContentView

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setCustomContentView(contentView: RemoteViews?): NotificationCompat.Builder
```

Supply custom RemoteViews to use instead of the platform template. This will override the layout that would otherwise be constructed by this Builder object.

### setCustomHeadsUpContentView

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setCustomHeadsUpContentView(contentView: RemoteViews?): NotificationCompat.Builder
```

Supply custom RemoteViews to use instead of the platform template in the heads up dialog. This will override the heads-up layout that would otherwise be constructed by this Builder object. No-op on versions prior to `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#LOLLIPOP`.

### setDefaults

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setDefaults(defaults: Int): NotificationCompat.Builder
```

Set the default notification options that will be used.

The value should be one or more of the following fields combined with bitwise-or: `https://developer.android.com/reference/android/app/Notification.html#DEFAULT_SOUND`, `https://developer.android.com/reference/android/app/Notification.html#DEFAULT_VIBRATE`, `https://developer.android.com/reference/android/app/Notification.html#DEFAULT_LIGHTS`.

For all default values, use `https://developer.android.com/reference/android/app/Notification.html#DEFAULT_ALL`.

On platforms `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#O` and above this value is ignored in favor of the values set on the `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setChannelId(java.lang.String)`. On older platforms, this value is still used, so it is still required for apps supporting those platforms.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat.Builder#setVibrationEnabled(boolean)` |   |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat.Builder#setLightsEnabled(boolean)` |   |

### setDeleteIntent

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setDeleteIntent(intent: PendingIntent?): NotificationCompat.Builder
```

Supply a `https://developer.android.com/reference/android/app/PendingIntent.html` to send when the notification is cleared by the user directly from the notification panel. For example, this intent is sent when the user clicks the "Clear all" button, or the individual "X" buttons on notifications. This intent is not sent when the application calls `https://developer.android.com/reference/android/app/NotificationManager.html#cancel(int)`.

### setExtras

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setExtras(extras: Bundle?): NotificationCompat.Builder
```

Set metadata for this notification.

A reference to the Bundle is held for the lifetime of this Builder, and the Bundle's current contents are copied into the Notification each time `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#build()` is called.

Replaces any existing extras values with those from the provided Bundle. Use `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#addExtras(android.os.Bundle)` to merge in metadata instead.

| See also |
|---|---|
| `https://developer.android.com/reference/android/app/Notification.html#extras` |   |

### setForegroundServiceBehavior

Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/core#1.7.0)

```
fun setForegroundServiceBehavior(behavior: Int): NotificationCompat.Builder
```

Specify a desired visibility policy for a Notification associated with a foreground service. The default value is `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat#FOREGROUND_SERVICE_DEFAULT()`, meaning the system can choose to defer visibility of the notification for a short time after the service is started. Pass `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat#FOREGROUND_SERVICE_IMMEDIATE()` to this method in order to guarantee that visibility is never deferred. Pass `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat#FOREGROUND_SERVICE_DEFERRED()` to request that visibility is deferred whenever possible.

Note that deferred visibility is not guaranteed. There may be some circumstances under which the system will show the foreground service's associated Notification immediately even when the app has used this method to explicitly request deferred display.
This method has no effect when running on versions prior to `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#S`.

### setFullScreenIntent

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setFullScreenIntent(intent: PendingIntent?, highPriority: Boolean): NotificationCompat.Builder
```

An intent to launch instead of posting the notification to the status bar. Only for use with extremely high-priority notifications demanding the user's **immediate** attention, such as an incoming phone call or alarm clock that the user has explicitly set to a particular time. If this facility is used for something else, please give the user an option to turn it off and use a normal notification, as this can be extremely disruptive.

On some platforms, the system UI may choose to display a heads-up notification, instead of launching this intent, while the user is using the device.

| Parameters |
|---|---|
| `intent: https://developer.android.com/reference/android/app/PendingIntent.html?` | The pending intent to launch. |
| `highPriority: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Passing true will cause this notification to be sent even if other notifications are suppressed. |

### setGroup

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setGroup(groupKey: String?): NotificationCompat.Builder
```

Set this notification to be part of a group of notifications sharing the same key. Grouped notifications may display in a cluster or stack on devices which support such rendering.

To make this notification the summary for its group, also call `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setGroupSummary(boolean)`. A sort order can be specified for group members by using `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setSortKey(java.lang.String)`.

| Parameters |
|---|---|
| `groupKey: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | The group key of the group. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | this object for method chaining |

### setGroupAlertBehavior

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setGroupAlertBehavior(groupAlertBehavior: Int): NotificationCompat.Builder
```

Sets the group alert behavior for this notification. Use this method to mute this notification if alerts for this notification's group should be handled by a different notification. This is only applicable for notifications that belong to a `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setGroup(java.lang.String)`. This must be called on all notifications you want to mute. For example, if you want only the summary of your group to make noise, all children in the group should have the group alert behavior `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat#GROUP_ALERT_SUMMARY()`.

The default value is `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat#GROUP_ALERT_ALL()`.

### setGroupSummary

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setGroupSummary(isGroupSummary: Boolean): NotificationCompat.Builder
```

Set this notification to be the group summary for a group of notifications. Grouped notifications may display in a cluster or stack on devices which support such rendering. Requires a group key also be set using `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setGroup(java.lang.String)`.

| Parameters |
|---|---|
| `isGroupSummary: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether this notification should be a group summary. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | this object for method chaining |

### setLargeIcon

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setLargeIcon(icon: Bitmap?): NotificationCompat.Builder
```

Sets the large icon that is shown in the notification. Icons will be scaled on versions before API 27. Starting in API 27, the framework does this automatically.

### setLargeIcon

Added in [1.11.0](https://developer.android.com/jetpack/androidx/releases/core#1.11.0)

```
fun setLargeIcon(icon: Icon?): NotificationCompat.Builder
```

Sets the large icon that is shown in the notification. Starting in API 27, the framework scales icons automatically. Before API 27, for safety, `#reduceLargeIconSize` should be called on bitmaps before putting them in an `Icon` and passing them into this function.

### setLights

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setLights(argb: @ColorInt Int, onMs: Int, offMs: Int): NotificationCompat.Builder
```

Set the argb value that you would like the LED on the device to blink, as well as the rate. The rate is specified in terms of the number of milliseconds to be on and then the number of milliseconds to be off.

On platforms `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#O` and above this value is ignored in favor of the value set on the `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setChannelId(java.lang.String)`. On older platforms, this value is still used, so it is still required for apps supporting those platforms.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat.Builder#setLightsEnabled(boolean)` |   |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat.Builder#setLightColor(int)` |   |

### setLocalOnly

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setLocalOnly(b: Boolean): NotificationCompat.Builder
```

Set whether or not this notification is only relevant to the current device.

Some notifications can be bridged to other devices for remote display. This hint can be set to recommend this notification not be bridged.

### setLocusId

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun setLocusId(locusId: LocusIdCompat?): NotificationCompat.Builder
```

Sets the `https://developer.android.com/reference/kotlin/androidx/core/content/LocusIdCompat` associated with this notification.

This method should be called when the `https://developer.android.com/reference/kotlin/androidx/core/content/LocusIdCompat` is used in other places (such as `https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat` and `https://developer.android.com/reference/android/view/contentcapture/ContentCaptureContext.html`) so the device's intelligence services can correlate them.

### setNotificationSilent

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/core#1.3.0) Deprecated in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun [setNotificationSilent](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setNotificationSilent())(): NotificationCompat.Builder
```

> [!CAUTION]
> **This function is deprecated.**   
>
> use `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setSilent(boolean)`

Silences this instance of the notification, regardless of the sounds or vibrations set on the notification or notification channel.

### setNumber

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setNumber(number: Int): NotificationCompat.Builder
```

Sets the number of items this notification represents. On the latest platforms, this may be displayed as a badge count for Launchers that support badging. Prior to `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#O` it could be shown in the header. And prior to `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#N` this was shown in the notification on the right side.

### setOngoing

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setOngoing(ongoing: Boolean): NotificationCompat.Builder
```

Set whether this is an ongoing notification. Ongoing notifications cannot be dismissed by the user, so your application or service must take care of canceling them. They are typically used to indicate a background task that the user is actively engaged with (e.g., playing music) or is pending in some way and therefore occupying the device (e.g., a file download, sync operation, active network connection).

| See also |
|---|---|
| `https://developer.android.com/reference/android/app/Notification.html#FLAG_ONGOING_EVENT` |   |

### setOnlyAlertOnce

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setOnlyAlertOnce(onlyAlertOnce: Boolean): NotificationCompat.Builder
```

Set this flag if you would only like the sound, vibrate and ticker to be played if the notification is not already showing.

### setPriority

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setPriority(pri: Int): NotificationCompat.Builder
```

Set the relative priority for this notification.

Priority is an indication of how much of the user's valuable attention should be consumed by this notification. Low-priority notifications may be hidden from the user in certain situations, while the user might be interrupted for a higher-priority notification. The system sets a notification's priority based on various factors including the setPriority value. The effect may differ slightly on different platforms.

On platforms `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#O` and above this value is ignored in favor of the importance value set on the `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setChannelId(java.lang.String)`. On older platforms, this value is still used, so it is still required for apps supporting those platforms.

| Parameters |
|---|---|
| `pri: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Relative priority for this notification. Must be one of the priority constants defined by `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat`. Acceptable values range from `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat#PRIORITY_MIN()` (-2) to `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat#PRIORITY_MAX()` (2). |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat.Builder#setImportance(int)` |   |

### setProgress

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setProgress(max: Int, progress: Int, indeterminate: Boolean): NotificationCompat.Builder
```

Set the progress this notification represents, which may be represented as a `https://developer.android.com/reference/android/widget/ProgressBar.html`.

### setPublicVersion

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setPublicVersion(n: Notification?): NotificationCompat.Builder
```

Supply a replacement Notification whose contents should be shown in insecure contexts (i.e. atop the secure lockscreen). See `https://developer.android.com/reference/android/app/Notification.html#visibility` and `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat#VISIBILITY_PUBLIC()`.

| Parameters |
|---|---|
| `n: https://developer.android.com/reference/android/app/Notification.html?` | A replacement notification, presumably with some or all info redacted. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder` | The same Builder. |

### setRemoteInputHistory

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setRemoteInputHistory(text: Array<CharSequence!>?): NotificationCompat.Builder
```

Set the remote input history. This should be set to the most recent inputs that have been sent through a `https://developer.android.com/reference/kotlin/androidx/core/app/RemoteInput` of this Notification and cleared once the it is no longer relevant (e.g. for chat notifications once the other party has responded). The most recent input must be stored at the 0 index, the second most recent at the 1 index, etc. Note that the system will limit both how far back the inputs will be shown and how much of each individual input is shown.

Note: The reply text will only be shown on notifications that have least one action with a `RemoteInput`.

### setRequestPromotedOngoing

Added in [1.17.0](https://developer.android.com/jetpack/androidx/releases/core#1.17.0)

```
fun setRequestPromotedOngoing(requestPromotedOngoing: Boolean): NotificationCompat.Builder
```

Set whether this notification is requesting to be a promoted ongoing notification.

This is the first requirement of `https://developer.android.com/reference/android/app/Notification.html#hasPromotableCharacteristics()`.

### setSettingsText

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun setSettingsText(text: CharSequence?): NotificationCompat.Builder
```

Provides text that will appear as a link to your application's settings.

This text does not appear within notification `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Style` but may appear when the user uses an affordance to learn more about the notification. Additionally, this text will not appear unless you provide a valid link target by handling `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat#INTENT_CATEGORY_NOTIFICATION_PREFERENCES()`.

This text is meant to be concise description about what the user can customize when they click on this link. The recommended maximum length is 40 characters.

Prior to `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#O` this field has no effect.

### setShortCriticalText

Added in [1.17.0](https://developer.android.com/jetpack/androidx/releases/core#1.17.0)

```
fun setShortCriticalText(shortCriticalText: String?): NotificationCompat.Builder
```

Sets a very short string summarizing the most critical information contained in the notification. Suggested max length is 7 characters, and there is no guarantee how much or how little of this text will be shown.

This field is designed exclusively for the compact representation (hereafter "chip") shown when the notification is `https://developer.android.com/reference/android/app/Notification.html#FLAG_PROMOTED_ONGOING`.

- A chip's content may not be shown in certain states or if it cannot fit.
- Short critical text will always be the highest precedence content for a chip.
- Setting this to `""` will ensure the chip has no content; `null` (the default) will fall back to the other options.
- A `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.MetricStyle`'s critical metric, if supported by the platform, is the next option for the chip's content.
- A time (from `https://developer.android.com/reference/android/app/Notification.html#when`) is the final source of content for the chip.
  - If `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setUsesChronometer(boolean)` is `true`, the chip content will be a chronometer, if that is positive (based on `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setChronometerCountDown(boolean)`).
  - If `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setShowWhen(boolean)` is true, the chip content will be the time remaining until `https://developer.android.com/reference/android/app/Notification.html#when`, if positive.

### setShortcutId

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setShortcutId(shortcutId: String?): NotificationCompat.Builder
```

From Android 11, messaging notifications (those that use `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.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. This behavior should be reserved for person to person(s) conversations where there is a likely social obligation for an individual to respond.

For example, the following are some examples of notifications that belong in the conversation space:

- 1:1 conversations between two individuals
- Group conversations between individuals where everyone can contribute

And the following are some examples of notifications that do not belong in the conversation space:

<!-- -->

- Advertisements from a bot (even if personal and contextualized)
- Engagement notifications from a bot
- Directional conversations where there is an active speaker and many passive individuals
- Stream / posting updates from other individuals
- Email, document comments, or other conversation types that are not real-time

Additionally, this method can be used for all types of notifications to mark this notification as duplicative of a Launcher shortcut. Launchers that show badges or notification content may then suppress the shortcut in favor of the content of this notification.

If this notification has `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.BubbleMetadata` attached that was created with a shortcutId a check will be performed to ensure the shortcutId supplied to bubble metadata matches the shortcutId set here, if one was set. If the shortcutId's were specified but do not match, an exception is thrown.

| Parameters |
|---|---|
| `shortcutId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | the `https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat#getId()` of the shortcut this notification is linked to |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.BubbleMetadata.Builder#Builder()` |   |

### setShortcutInfo

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun setShortcutInfo(shortcutInfo: ShortcutInfoCompat?): NotificationCompat.Builder
```

Populates this notification with given `https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat`.

Sets `https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat#getId()` based on the given shortcut. In addition, it also sets `https://developer.android.com/reference/kotlin/androidx/core/content/LocusIdCompat` and `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setContentTitle(java.lang.CharSequence)` if they were empty.

### setShowWhen

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setShowWhen(show: Boolean): NotificationCompat.Builder
```

Control whether the timestamp set with `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setWhen(long)` is shown in the content view. The default is `true`.

### setSilent

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun setSilent(silent: Boolean): NotificationCompat.Builder
```

If `true`, silences this instance of the notification and prevents the notification from peeking on screen, regardless of the importance, sounds, or vibrations set on the notification or notification channel. If `false`, then the normal sound and vibration logic applies. Defaults to `false`.

### setSmallIcon

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun setSmallIcon(icon: IconCompat): NotificationCompat.Builder
```

Set the small icon to use in the notification layouts. Different classes of devices may return different sizes. See the UX guidelines for more information on how to design these icons.

| Parameters |
|---|---|
| `icon: https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat` | The small Icon object to use |

### setSmallIcon

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setSmallIcon(icon: Int): NotificationCompat.Builder
```

Set the small icon to use in the notification layouts. Different classes of devices may return different sizes. See the UX guidelines for more information on how to design these icons.

| Parameters |
|---|---|
| `icon: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | A resource ID in the application's package of the drawable to use. |

### setSmallIcon

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setSmallIcon(icon: Int, level: Int): NotificationCompat.Builder
```

A variant of `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setSmallIcon(int)` that takes an additional level parameter for when the icon is a `https://developer.android.com/reference/android/graphics/drawable/LevelListDrawable.html`.

| Parameters |
|---|---|
| `icon: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | A resource ID in the application's package of the drawable to use. |
| `level: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The level to use for the icon. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/graphics/drawable/LevelListDrawable.html` |   |

### setSortKey

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setSortKey(sortKey: String?): NotificationCompat.Builder
```

Set a sort key that orders this notification among other notifications from the same package. This can be useful if an external sort was already applied and an app would like to preserve this. Notifications will be sorted lexicographically using this value, although providing different priorities in addition to providing sort key may cause this value to be ignored.

This sort key can also be used to order members of a notification group. See `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setGroup(java.lang.String)`.

| See also |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html#compareTo(java.lang.String)` |   |

### setSound

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setSound(sound: Uri?): NotificationCompat.Builder
```

Set the sound to play. It will play on the default stream.

On some platforms, a notification that is noisy is more likely to be presented as a heads-up notification.

On platforms `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#O` and above this value is ignored in favor of the value set on the `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setChannelId(java.lang.String)`. On older platforms, this value is still used, so it is still required for apps supporting those platforms.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat.Builder#setSound(android.net.Uri,android.media.AudioAttributes)` |   |

### setSound

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setSound(sound: Uri?, streamType: Int): NotificationCompat.Builder
```

Set the sound to play. It will play on the stream you supply.

On some platforms, a notification that is noisy is more likely to be presented as a heads-up notification.

On platforms `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#O` and above this value is ignored in favor of the value set on the `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setChannelId(java.lang.String)`. On older platforms, this value is still used, so it is still required for apps supporting those platforms.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat.Builder#setSound(android.net.Uri,android.media.AudioAttributes)` |   |
| `https://developer.android.com/reference/android/app/Notification.html#STREAM_DEFAULT` |   |
| `https://developer.android.com/reference/android/media/AudioManager.html` | for the `STREAM_` constants. |

### setStyle

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setStyle(style: NotificationCompat.Style?): NotificationCompat.Builder
```

Add a rich notification style to be applied at build time. If the platform does not provide rich notification styles, this method has no effect. The user will always see the normal notification style.

| Parameters |
|---|---|
| `style: https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Style?` | Object responsible for modifying the notification style. |

### setSubText

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setSubText(text: CharSequence?): NotificationCompat.Builder
```

This provides some additional information that is displayed in the notification. No guarantees are given where exactly it is displayed.

This information should only be provided if it provides an essential benefit to the understanding of the notification. The more text you provide the less readable it becomes. For example, an email client should only provide the account name here if more than one email account has been added.

As of `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#N` this information is displayed in the notification header area.

On Android versions before `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#N` this will be shown in the third line of text in the platform notification template. You should not be using `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setProgress(int,int,boolean)` at the same time on those versions; they occupy the same place.

### setTicker

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setTicker(tickerText: CharSequence?): NotificationCompat.Builder
```

Sets the "ticker" text which is sent to accessibility services. Prior to `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#LOLLIPOP`, sets the text that is displayed in the status bar when the notification first arrives.

### setTicker

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0) Deprecated in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun [setTicker](https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setTicker(java.lang.CharSequence,android.widget.RemoteViews))(tickerText: CharSequence?, views: RemoteViews?): NotificationCompat.Builder
```

> [!CAUTION]
> **This function is deprecated.**   
>
> use `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setTicker(java.lang.CharSequence)`

Sets the "ticker" text which is sent to accessibility services. Prior to `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#LOLLIPOP`, sets the text that is displayed in the status bar when the notification first arrives, and also a RemoteViews object that may be displayed instead on some devices.

### setTimeoutAfter

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setTimeoutAfter(durationMs: Long): NotificationCompat.Builder
```

Specifies the time at which this notification should be canceled, if it is not already canceled. No-op on versions prior to `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#O`.

### setUsesChronometer

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setUsesChronometer(b: Boolean): NotificationCompat.Builder
```

Show the `https://developer.android.com/reference/android/app/Notification.html#when` field as a stopwatch. Instead of presenting `when` as a timestamp, the notification will show an automatically updating display of the minutes and seconds since `when`. Useful when showing an elapsed time (like an ongoing phone call).

| See also |
|---|---|
| `https://developer.android.com/reference/android/widget/Chronometer.html` |   |
| `https://developer.android.com/reference/android/app/Notification.html#when` |   |

### setVibrate

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setVibrate(pattern: LongArray<Long>?): NotificationCompat.Builder
```

Set the vibration pattern to use.

On some platforms, a notification that vibrates is more likely to be presented as a heads-up notification.

On platforms `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#O` and above this value is ignored in favor of the value set on the `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationCompat.Builder#setChannelId(java.lang.String)`. On older platforms, this value is still used, so it is still required for apps supporting those platforms.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat.Builder#setVibrationEnabled(boolean)` |   |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat.Builder#setVibrationPattern(long[])` |   |
| `https://developer.android.com/reference/android/os/Vibrator.html` | for a discussion of the `pattern`parameter. |

### setVisibility

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setVisibility(visibility: Int): NotificationCompat.Builder
```

Sets `https://developer.android.com/reference/android/app/Notification.html#visibility`.

| Parameters |
|---|---|
| `visibility: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | One of `https://developer.android.com/reference/android/app/Notification.html#VISIBILITY_PRIVATE` (the default), `https://developer.android.com/reference/android/app/Notification.html#VISIBILITY_PUBLIC`, or `https://developer.android.com/reference/android/app/Notification.html#VISIBILITY_SECRET`. |

### setWhen

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun setWhen(when: Long): NotificationCompat.Builder
```

Set the time that the event occurred. Notifications in the panel are sorted by this time.

## Protected functions

### limitCharSequenceLength

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
protected java-static fun limitCharSequenceLength(cs: CharSequence?): CharSequence?
```

## Public properties

### mPeople

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
val mPeople: ArrayList<String!>!
```

> [!CAUTION]
> **This property is deprecated.**   
>
> This field was not meant to be public.