Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Builder

*** ** * ** ***

```
open class Builder
```

|---|---|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||
| ↳ | [android.app.Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) |

Builder class for `https://developer.android.com/reference/kotlin/android/app/Notification` objects.

Provides a convenient way to set the various fields of a `https://developer.android.com/reference/kotlin/android/app/Notification` and generate content views using the platform's notification layout template. If your app supports versions of Android as old as API level 4, you can instead use androidx.core.app.NotificationCompat.Builder, available in the [Android Support library](https://developer.android.com/tools/extras/support-library.html).

Example:

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

## Summary

| Public constructors ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#Builder(android.content.Context)(context: https://developer.android.com/reference/kotlin/android/content/Context.html#!)` <br /> |
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#Builder(android.content.Context,%20kotlin.String)(context: https://developer.android.com/reference/kotlin/android/content/Context.html#!, channelId: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Constructs a new Builder with the defaults: |

| Public methods ||
|---|---|
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#addAction(android.app.Notification.Action)(action: https://developer.android.com/reference/kotlin/android/app/Notification.Action!)` Add an action to this notification. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#)! | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#addAction(kotlin.Int,%20kotlin.CharSequence,%20android.app.PendingIntent)(icon: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, title: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html!, intent: https://developer.android.com/reference/kotlin/android/app/PendingIntent!)` Add an action to this notification. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#addExtras(android.os.Bundle)(extras: https://developer.android.com/reference/kotlin/android/os/Bundle.html#!)` Merge additional metadata into this notification. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#addPerson(android.app.Person)(person: https://developer.android.com/reference/kotlin/android/app/Person!)` Add a person that is relevant to this notification. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#)! | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#addPerson(kotlin.String)(uri: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Add a person that is relevant to this notification. |
| open [Notification](https://developer.android.com/reference/kotlin/android/app/Notification) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#build()()` Combine all of the options that have been set and return a new `https://developer.android.com/reference/kotlin/android/app/Notification` object. |
| open [RemoteViews](https://developer.android.com/reference/kotlin/android/widget/RemoteViews.html#)! | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#createBigContentView()()` Construct a RemoteViews representing the expanded notification layout. |
| open [RemoteViews](https://developer.android.com/reference/kotlin/android/widget/RemoteViews.html#)! | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#createContentView()()` Construct a RemoteViews representing the standard notification layout. |
| open [RemoteViews](https://developer.android.com/reference/kotlin/android/widget/RemoteViews.html#)! | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#createHeadsUpContentView()()` Construct a RemoteViews representing the heads up notification layout. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#extend(android.app.Notification.Extender)(extender: https://developer.android.com/reference/kotlin/android/app/Notification.Extender!)` Apply an extender to this notification builder. |
| open [Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)! | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#getExtras()()` Get the current metadata Bundle used by this notification Builder. |
| open [Notification](https://developer.android.com/reference/kotlin/android/app/Notification)! | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#getNotification()()` <br /> |
| open [Notification.Style](https://developer.android.com/reference/kotlin/android/app/Notification.Style)! | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#getStyle()()` Returns the style set by `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setStyle(android.app.Notification.Style)`. |
| open static [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#recoverBuilder(android.content.Context,%20android.app.Notification)(context: https://developer.android.com/reference/kotlin/android/content/Context.html#!, n: https://developer.android.com/reference/kotlin/android/app/Notification!)` Creates a Builder from an existing notification so further changes can be made. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setActions(android.app.Notification.Action)(vararg actions: https://developer.android.com/reference/kotlin/android/app/Notification.Action!)` Alter the complete list of actions attached to this notification. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setAllowSystemGeneratedContextualActions(kotlin.Boolean)(allowed: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Determines whether the platform can generate contextual actions for a notification. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setAutoCancel(kotlin.Boolean)(autoCancel: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Make this notification automatically dismissed when the user touches it. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setBadgeIconType(kotlin.Int)(icon: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Sets which icon to display as a badge for this notification. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setBubbleMetadata(android.app.Notification.BubbleMetadata)(data: https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata?)` Sets the `https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata` that will be used to display app content in a floating window over the existing foreground activity. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setCategory(kotlin.String)(category: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Set the notification category. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setChannelId(kotlin.String)(channelId: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Specifies the channel the notification should be delivered on. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setChronometerCountDown(kotlin.Boolean)(countDown: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Sets the Chronometer to count down instead of counting up. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setColor(kotlin.Int)(argb: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Sets `https://developer.android.com/reference/kotlin/android/app/Notification#color:kotlin.Int`. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setColorized(kotlin.Boolean)(colorize: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Set whether this notification should be colorized. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#)! | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setContent(android.widget.RemoteViews)(views: https://developer.android.com/reference/kotlin/android/widget/RemoteViews.html#!)` Supply a custom RemoteViews to use instead of the platform template. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#)! | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setContentInfo(kotlin.CharSequence)(info: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html!)` A small piece of additional information pertaining to this notification. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setContentIntent(android.app.PendingIntent)(intent: https://developer.android.com/reference/kotlin/android/app/PendingIntent!)` Supply a `https://developer.android.com/reference/kotlin/android/app/PendingIntent` to be sent when the notification is clicked. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setContentText(kotlin.CharSequence)(text: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html!)` Set the second line of text in the platform notification template. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setContentTitle(kotlin.CharSequence)(title: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html!)` Set the first line of text in the platform notification template. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setCustomBigContentView(android.widget.RemoteViews)(contentView: https://developer.android.com/reference/kotlin/android/widget/RemoteViews.html#!)` Supply custom RemoteViews to use instead of the platform template in the expanded form. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setCustomContentView(android.widget.RemoteViews)(contentView: https://developer.android.com/reference/kotlin/android/widget/RemoteViews.html#!)` Supply custom RemoteViews to use instead of the platform template. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setCustomHeadsUpContentView(android.widget.RemoteViews)(contentView: https://developer.android.com/reference/kotlin/android/widget/RemoteViews.html#!)` Supply custom RemoteViews to use instead of the platform template in the heads up dialog. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#)! | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setDefaults(kotlin.Int)(defaults: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Set which notification properties will be inherited from system defaults. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setDeleteIntent(android.app.PendingIntent)(intent: https://developer.android.com/reference/kotlin/android/app/PendingIntent!)` Supply a `https://developer.android.com/reference/kotlin/android/app/PendingIntent` to send when the notification is cleared explicitly by the user. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setExtras(android.os.Bundle)(extras: https://developer.android.com/reference/kotlin/android/os/Bundle.html#!)` Set metadata for this notification. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setFlag(kotlin.Int,%20kotlin.Boolean)(mask: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, value: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Set the value for a notification flag |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setForegroundServiceBehavior(kotlin.Int)(behavior: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Specify a desired visibility policy for a Notification associated with a foreground service. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setFullScreenIntent(android.app.PendingIntent,%20kotlin.Boolean)(intent: https://developer.android.com/reference/kotlin/android/app/PendingIntent!, highPriority: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` An intent to launch instead of posting the notification to the status bar. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setGroup(kotlin.String)(groupKey: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Set this notification to be part of a group of notifications sharing the same key. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setGroupAlertBehavior(kotlin.Int)(groupAlertBehavior: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Sets the group alert behavior for this notification. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setGroupSummary(kotlin.Boolean)(isGroupSummary: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Set this notification to be the group summary for a group of notifications. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setHasSummarizedContent(kotlin.Boolean)(hasSummarizedContent: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Sets whether this notification contains text that was computationally summarized from other sources. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setLargeIcon(android.graphics.Bitmap)(b: https://developer.android.com/reference/kotlin/android/graphics/Bitmap.html#!)` Add a large icon to the notification content view. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setLargeIcon(android.graphics.drawable.Icon)(icon: https://developer.android.com/reference/kotlin/android/graphics/drawable/Icon.html#!)` Add a large icon to the notification content view. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#)! | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setLights(kotlin.Int,%20kotlin.Int,%20kotlin.Int)(argb: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, onMs: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, offMs: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Set the desired color for the indicator LED on the device, as well as the blink duty cycle (specified in milliseconds). |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setLocalOnly(kotlin.Boolean)(localOnly: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Set whether or not this notification should not bridge to other devices. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setLocusId(android.content.LocusId)(locusId: https://developer.android.com/reference/kotlin/android/content/LocusId.html#?)` Sets the `https://developer.android.com/reference/kotlin/android/content/LocusId.html#` associated with this notification. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setNumber(kotlin.Int)(number: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Sets the number of items this notification represents. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setOngoing(kotlin.Boolean)(ongoing: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Set whether this is an "ongoing" notification. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setOnlyAlertOnce(kotlin.Boolean)(onlyAlertOnce: https://kotlinlang.org/api/latest/jvm/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. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#)! | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setPriority(kotlin.Int)(pri: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Set the priority of this notification. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setProgress(kotlin.Int,%20kotlin.Int,%20kotlin.Boolean)(max: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, progress: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, indeterminate: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Set the progress this notification represents. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setPublicVersion(android.app.Notification)(n: https://developer.android.com/reference/kotlin/android/app/Notification!)` Supply a replacement Notification whose contents should be shown in insecure contexts (i.e. atop the secure lockscreen). |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setRemoteInputHistory(kotlin.Array)(text: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html!>!)` Set the remote input history. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setRequestPromotedOngoing(kotlin.Boolean)(requestPromotedOngoing: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Set whether this notification is requesting to be a promoted ongoing notification. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setSettingsText(kotlin.CharSequence)(text: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html!)` Provides text that will appear as a link to your application's settings. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setShortCriticalText(kotlin.String)(shortCriticalText: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?)` Sets a very short string summarizing the most critical information contained in the notification. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setShortcutId(kotlin.String)(shortcutId: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` From Android 11, messaging notifications (those that use `https://developer.android.com/reference/kotlin/android/app/Notification.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. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setShowWhen(kotlin.Boolean)(show: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Control whether the timestamp set with `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setWhen(kotlin.Long)` is shown in the content view. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setSmallIcon(android.graphics.drawable.Icon)(icon: https://developer.android.com/reference/kotlin/android/graphics/drawable/Icon.html#!)` Set the small icon, which will be used to represent the notification in the status bar. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setSmallIcon(kotlin.Int)(icon: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Set the small icon resource, which will be used to represent the notification in the status bar. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setSmallIcon(kotlin.Int,%20kotlin.Int)(icon: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, level: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` A variant of `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setSmallIcon(kotlin.Int)` that takes an additional level parameter for when the icon is a `https://developer.android.com/reference/kotlin/android/graphics/drawable/LevelListDrawable.html#`. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setSortKey(kotlin.String)(sortKey: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Set a sort key that orders this notification among other notifications from the same package. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#)! | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setSound(android.net.Uri)(sound: https://developer.android.com/reference/kotlin/android/net/Uri.html#!)` Set the sound to play. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#)! | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setSound(android.net.Uri,%20android.media.AudioAttributes)(sound: https://developer.android.com/reference/kotlin/android/net/Uri.html#!, audioAttributes: https://developer.android.com/reference/kotlin/android/media/AudioAttributes.html#!)` Set the sound to play, along with specific `https://developer.android.com/reference/kotlin/android/media/AudioAttributes.html#` to use during playback. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#)! | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setSound(android.net.Uri,%20kotlin.Int)(sound: https://developer.android.com/reference/kotlin/android/net/Uri.html#!, streamType: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Set the sound to play, along with a specific stream on which to play it. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setStyle(android.app.Notification.Style)(style: https://developer.android.com/reference/kotlin/android/app/Notification.Style!)` Add a rich notification style to be applied at build time. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setSubText(kotlin.CharSequence)(text: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html!)` This provides some additional information that is displayed in the notification. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setTicker(kotlin.CharSequence)(tickerText: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html!)` Set the "ticker" text which is sent to accessibility services. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#)! | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setTicker(kotlin.CharSequence,%20android.widget.RemoteViews)(tickerText: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html!, views: https://developer.android.com/reference/kotlin/android/widget/RemoteViews.html#!)` Obsolete version of `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setTicker(kotlin.CharSequence)`. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setTimeoutAfter(kotlin.Long)(durationMs: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)` Specifies a duration in milliseconds after which this notification should be canceled, if it is not already canceled. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setUsesChronometer(kotlin.Boolean)(b: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Show the `https://developer.android.com/reference/kotlin/android/app/Notification#when:kotlin.Long` field as a stopwatch. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#)! | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setVibrate(kotlin.LongArray)(pattern: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long-array/index.html!)` Set the vibration pattern to use. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setVisibility(kotlin.Int)(visibility: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Specify the value of `https://developer.android.com/reference/kotlin/android/app/Notification#visibility:kotlin.Int`. |
| open [Notification.Builder](https://developer.android.com/reference/kotlin/android/app/Notification.Builder#) | `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setWhen(kotlin.Long)(when: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)` Add a timestamp pertaining to the notification (usually the time the event occurred). |

## Public constructors

### Builder

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
Builder(context: Context!)
```

**Deprecated:** *use `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#Builder(android.content.Context,%20kotlin.String)` instead. All posted Notifications must specify a NotificationChannel Id.*

### Builder

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

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

Constructs a new Builder with the defaults:

| Parameters ||
|---|---|
| `context` | [Context](https://developer.android.com/reference/kotlin/android/content/Context.html#)!: A `https://developer.android.com/reference/kotlin/android/content/Context.html#` that will be used by the Builder to construct the RemoteViews. The Context will not be held past the lifetime of this Builder object. |
| `channelId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: The constructed Notification will be posted on this `https://developer.android.com/reference/kotlin/android/app/NotificationChannel`. To use a NotificationChannel, it must first be created using `https://developer.android.com/reference/kotlin/android/app/NotificationManager#createNotificationChannel(android.app.NotificationChannel)`. |

## Public methods

### addAction

Added in [API level 20](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun addAction(action: Notification.Action!): Notification.Builder
```

Add an action to this notification. Actions are typically displayed by the system as a button adjacent to the notification content.

Every action must have an icon (32dp square and matching the [Holo Dark action bar](https://developer.android.com/design/style/iconography.html#action-bar) visual style), a textual label, and a `https://developer.android.com/reference/kotlin/android/app/PendingIntent`.

A notification in its expanded form can display up to 3 actions, from left to right in the order they were added. Actions will not be displayed when the notification is collapsed, however, so be sure that any essential functions may be accessed by the user in some other way (for example, in the Activity pointed to by `https://developer.android.com/reference/kotlin/android/app/Notification#contentIntent:android.app.PendingIntent`).

| Parameters ||
|---|---|
| `action` | [Notification.Action](https://developer.android.com/reference/kotlin/android/app/Notification.Action)!: the action to add |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

### addAction

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun addAction(
    icon: Int, 
    title: CharSequence!, 
    intent: PendingIntent!
): Notification.Builder!
```

**Deprecated:** *Use `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#addAction(android.app.Notification.Action)` instead.*

Add an action to this notification. Actions are typically displayed by the system as a button adjacent to the notification content.

Every action must have an icon (32dp square and matching the [Holo Dark action bar](https://developer.android.com/design/style/iconography.html#action-bar) visual style), a textual label, and a `https://developer.android.com/reference/kotlin/android/app/PendingIntent`.

A notification in its expanded form can display up to 3 actions, from left to right in the order they were added. Actions will not be displayed when the notification is collapsed, however, so be sure that any essential functions may be accessed by the user in some other way (for example, in the Activity pointed to by `https://developer.android.com/reference/kotlin/android/app/Notification#contentIntent:android.app.PendingIntent`).

As of Android `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#S:kotlin.Int`, apps targeting API level `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#S:kotlin.Int` or higher won't be able to start activities while processing broadcast receivers or services in response to notification action clicks. To launch an activity in those cases, provide a `https://developer.android.com/reference/kotlin/android/app/PendingIntent` to the activity itself.

As of Android `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#N:kotlin.Int`, action button icons will not be displayed on action buttons, but are still required and are available to `https://developer.android.com/reference/kotlin/android/service/notification/NotificationListenerService.html#`, which may display them in other contexts, for example on a wearable device.

| Parameters ||
|---|---|
| `icon` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): resource ID of a drawable that represents the action |
| `title` | [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)!: text describing the action |
| `intent` | [PendingIntent](https://developer.android.com/reference/kotlin/android/app/PendingIntent)!: PendingIntent to be fired when the action is invoked |

### addExtras

Added in [API level 20](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun addExtras(extras: Bundle!): Notification.Builder
```

Merge additional metadata into this notification.

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

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/Notification#extras:android.os.Bundle`

### addPerson

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun addPerson(person: Person!): Notification.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/android/app/Notification#CATEGORY_CALL:kotlin.String` or `https://developer.android.com/reference/kotlin/android/app/Notification#CATEGORY_MESSAGE:kotlin.String`. 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` | [Person](https://developer.android.com/reference/kotlin/android/app/Person)!: the person to add |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/Notification#EXTRA_PEOPLE_LIST:kotlin.String`

### addPerson

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun addPerson(uri: String!): Notification.Builder!
```

**Deprecated:** *use `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#addPerson(android.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, if this notification is of category `https://developer.android.com/reference/kotlin/android/app/Notification#CATEGORY_CALL:kotlin.String` or `https://developer.android.com/reference/kotlin/android/app/Notification#CATEGORY_MESSAGE:kotlin.String`. The addition of people may also cause this notification to appear more prominently in the user interface.

The person should be specified by the `String` representation of a `https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts.html#CONTENT_LOOKUP_URI:android.net.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/kotlin/android/provider/ContactsContract.PhoneLookup.html#`. It is also possible to provide a URI with the schema `name:` in order to uniquely identify a person without an entry in the contacts database.

| Parameters ||
|---|---|
| `uri` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: a URI for the person |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/Notification#EXTRA_PEOPLE:kotlin.String`

### build

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

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

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

If this notification has `https://developer.android.com/reference/kotlin/android/app/Notification.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 on the notification builder, if one was set. If the shortcutId's were specified but do not match, an exception is thrown here.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification` | This value cannot be `null`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata.Builder#Builder(kotlin.String)`
- `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setShortcutId(kotlin.String)`

### createBigContentView

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun createBigContentView(): RemoteViews!
```

**Deprecated:** *For performance and system health reasons, this API is no longer required to be used directly by the System UI when rendering Notifications to the user. While the UI returned by this method will still represent the content of the Notification being built, it may differ from the visual style of the system. NOTE: this API has always had severe limitations; for example it does not support any interactivity, it ignores the app theme, it hard-codes the colors from the system theme at the time it is called, and it does Bitmap decoding on the main thread which can cause UI jank.*

Construct a RemoteViews representing the expanded notification layout.

### createContentView

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun createContentView(): RemoteViews!
```

**Deprecated:** *For performance and system health reasons, this API is no longer required to be used directly by the System UI when rendering Notifications to the user. While the UI returned by this method will still represent the content of the Notification being built, it may differ from the visual style of the system. NOTE: this API has always had severe limitations; for example it does not support any interactivity, it ignores the app theme, it hard-codes the colors from the system theme at the time it is called, and it does Bitmap decoding on the main thread which can cause UI jank.*

Construct a RemoteViews representing the standard notification layout.

### createHeadsUpContentView

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun createHeadsUpContentView(): RemoteViews!
```

**Deprecated:** *For performance and system health reasons, this API is no longer required to be used directly by the System UI when rendering Notifications to the user. While the UI returned by this method will still represent the content of the Notification being built, it may differ from the visual style of the system. NOTE: this API has always had severe limitations; for example it does not support any interactivity, it ignores the app theme, it hard-codes the colors from the system theme at the time it is called, and it does Bitmap decoding on the main thread which can cause UI jank.*

Construct a RemoteViews representing the heads up notification layout.

### extend

Added in [API level 20](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun extend(extender: Notification.Extender!): Notification.Builder
```

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

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

### getExtras

Added in [API level 20](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open 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/android/app/Notification.Builder#build()` is called.
**See Also**

- `https://developer.android.com/reference/kotlin/android/app/Notification#extras:android.os.Bundle`

### getNotification

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getNotification(): Notification!
```

**Deprecated:** *Use `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#build()` instead.*

### getStyle

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun getStyle(): Notification.Style!
```

Returns the style set by `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setStyle(android.app.Notification.Style)`.

### recoverBuilder

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open static fun recoverBuilder(
    context: Context!, 
    n: Notification!
): Notification.Builder
```

Creates a Builder from an existing notification so further changes can be made.

| Parameters ||
|---|---|
| `context` | [Context](https://developer.android.com/reference/kotlin/android/content/Context.html#)!: the context for your application / activity |
| `n` | [Notification](https://developer.android.com/reference/kotlin/android/app/Notification)!: the notification to create a Builder from |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

### setActions

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setActions(vararg actions: Notification.Action!): Notification.Builder
```

Alter the complete list of actions attached to this notification.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#addAction(android.app.Notification.Action)`

### setAllowSystemGeneratedContextualActions

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setAllowSystemGeneratedContextualActions(allowed: Boolean): Notification.Builder
```

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

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

### setAutoCancel

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setAutoCancel(autoCancel: Boolean): Notification.Builder
```

Make this notification automatically dismissed when the user touches it.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/Notification#FLAG_AUTO_CANCEL:kotlin.Int`

### setBadgeIconType

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setBadgeIconType(icon: Int): Notification.Builder
```

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

Must be one of `https://developer.android.com/reference/kotlin/android/app/Notification#BADGE_ICON_NONE:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/Notification#BADGE_ICON_SMALL:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/Notification#BADGE_ICON_LARGE:kotlin.Int`.

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

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

### setBubbleMetadata

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setBubbleMetadata(data: Notification.BubbleMetadata?): Notification.Builder
```

Sets the `https://developer.android.com/reference/kotlin/android/app/Notification.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/kotlin/android/app/NotificationChannel#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.

| Parameters ||
|---|---|
| `data` | [Notification.BubbleMetadata](https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata)?: This value may be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

### setCategory

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setCategory(category: String!): Notification.Builder
```

Set the notification category.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/Notification#category:kotlin.String`

### setChannelId

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setChannelId(channelId: String!): Notification.Builder
```

Specifies the channel the notification should be delivered on.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

### setChronometerCountDown

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setChronometerCountDown(countDown: Boolean): Notification.Builder
```

Sets the Chronometer to count down instead of counting up.

This is only relevant if `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setUsesChronometer(kotlin.Boolean)` has been set to `true`. If it isn't set the chronometer will count up.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setUsesChronometer(kotlin.Boolean)`

### setColor

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setColor(argb: Int): Notification.Builder
```

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

| Parameters ||
|---|---|
| `argb` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The accent color to use |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | the same Builder. This value cannot be `null`. |

### setColorized

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setColorized(colorize: Boolean): Notification.Builder
```

Set whether this notification should be colorized. When set, the color set with `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setColor(kotlin.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 `https://developer.android.com/reference/kotlin/android/app/Notification.MediaStyle` and `https://developer.android.com/reference/kotlin/android/app/Notification.DecoratedMediaCustomViewStyle` notifications that have a media session attached there is no such requirement.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setColor(kotlin.Int)`
- `https://developer.android.com/reference/kotlin/android/app/Notification.MediaStyle#setMediaSession(android.media.session.MediaSession.Token)`

### setContent

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setContent(views: RemoteViews!): Notification.Builder!
```

**Deprecated:** *Deprecated in Java.*

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

Use `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setCustomContentView(android.widget.RemoteViews)` instead.

### setContentInfo

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setContentInfo(info: CharSequence!): Notification.Builder!
```

**Deprecated:** *use `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setSubText(kotlin.CharSequence)` instead to set a text in the header. For legacy apps targeting a version below `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#N:kotlin.Int` this field will still show up, but the subtext will take precedence.*

A small piece of additional information pertaining to this notification.

The platform template will draw this on the last line of the notification, at the far right (to the right of a smallIcon if it has been placed there).

### setContentIntent

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setContentIntent(intent: PendingIntent!): Notification.Builder
```

Supply a `https://developer.android.com/reference/kotlin/android/app/PendingIntent` to be sent when the notification is clicked.

As of Android `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#S:kotlin.Int`, apps targeting API level `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#S:kotlin.Int` or higher won't be able to start activities while processing broadcast receivers or services in response to notification clicks. To launch an activity in those cases, provide a `https://developer.android.com/reference/kotlin/android/app/PendingIntent` for the activity itself.

As of `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#HONEYCOMB:kotlin.Int`, if this field is unset and you have specified a custom RemoteViews with `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setContent(android.widget.RemoteViews)`, you can use `https://developer.android.com/reference/kotlin/android/widget/RemoteViews.html#setOnClickPendingIntent(kotlin.Int,%20android.app.PendingIntent)` to assign PendingIntents to individual views in that custom layout (i.e., to create clickable buttons inside the notification view).

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/Notification#contentIntent:android.app.PendingIntent`

### setContentText

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setContentText(text: CharSequence!): Notification.Builder
```

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

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

### setContentTitle

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setContentTitle(title: CharSequence!): Notification.Builder
```

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

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

### setCustomBigContentView

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setCustomBigContentView(contentView: RemoteViews!): Notification.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.

Note: The maximum memory use of view hierarchy is limited to 5MB.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

### setCustomContentView

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setCustomContentView(contentView: RemoteViews!): Notification.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.

Note: The maximum memory use of view hierarchy is limited to 5MB.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

### setCustomHeadsUpContentView

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setCustomHeadsUpContentView(contentView: RemoteViews!): Notification.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.

Note: The maximum memory use of view hierarchy is limited to 5MB.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

### setDefaults

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setDefaults(defaults: Int): Notification.Builder!
```

**Deprecated:** *use `https://developer.android.com/reference/kotlin/android/app/NotificationChannel#enableVibration(kotlin.Boolean)` and `https://developer.android.com/reference/kotlin/android/app/NotificationChannel#enableLights(kotlin.Boolean)` and `https://developer.android.com/reference/kotlin/android/app/NotificationChannel#setSound(android.net.Uri,%20android.media.AudioAttributes)` instead.*

Set which notification properties will be inherited from system defaults.

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

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

### setDeleteIntent

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setDeleteIntent(intent: PendingIntent!): Notification.Builder
```

Supply a `https://developer.android.com/reference/kotlin/android/app/PendingIntent` to send when the notification is cleared explicitly by the user.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/Notification#deleteIntent:android.app.PendingIntent`

### setExtras

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setExtras(extras: Bundle!): Notification.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/android/app/Notification.Builder#build()` is called.

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

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/Notification#extras:android.os.Bundle`

### setFlag

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setFlag(
    mask: Int, 
    value: Boolean
): Notification.Builder
```

Set the value for a notification flag

| Parameters ||
|---|---|
| `mask` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Bit mask of the flag. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/kotlin/android/app/Notification#FLAG_SHOW_LIGHTS:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/Notification#FLAG_ONGOING_EVENT:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/Notification#FLAG_INSISTENT:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/Notification#FLAG_ONLY_ALERT_ONCE:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/Notification#FLAG_AUTO_CANCEL:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/Notification#FLAG_NO_CLEAR:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/Notification#FLAG_FOREGROUND_SERVICE:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/Notification#FLAG_HIGH_PRIORITY:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/Notification#FLAG_LOCAL_ONLY:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/Notification#FLAG_GROUP_SUMMARY:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/Notification#FLAG_BUBBLE:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/Notification#FLAG_PROMOTED_ONGOING:kotlin.Int` |
| `value` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): Status (on/off) of the flag |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | the same Builder. This value cannot be `null`. |

### setForegroundServiceBehavior

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setForegroundServiceBehavior(behavior: Int): Notification.Builder
```

Specify a desired visibility policy for a Notification associated with a foreground service. By default, 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/android/app/Notification#FOREGROUND_SERVICE_IMMEDIATE:kotlin.Int` to this method in order to guarantee that visibility is never deferred. Pass `https://developer.android.com/reference/kotlin/android/app/Notification#FOREGROUND_SERVICE_DEFERRED:kotlin.Int` 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.

| Parameters ||
|---|---|
| `behavior` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): One of `https://developer.android.com/reference/kotlin/android/app/Notification#FOREGROUND_SERVICE_DEFAULT:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/Notification#FOREGROUND_SERVICE_IMMEDIATE:kotlin.Int`, or `https://developer.android.com/reference/kotlin/android/app/Notification#FOREGROUND_SERVICE_DEFERRED:kotlin.Int` Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/Notification#FOREGROUND_SERVICE_DEFAULT:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/Notification#FOREGROUND_SERVICE_IMMEDIATE:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/Notification#FOREGROUND_SERVICE_DEFERRED:kotlin.Int` |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

### setFullScreenIntent

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setFullScreenIntent(
    intent: PendingIntent!, 
    highPriority: Boolean
): Notification.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.

Apps targeting `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#Q:kotlin.Int` and above will have to request a permission (`https://developer.android.com/reference/kotlin/android/Manifest.permission.html#USE_FULL_SCREEN_INTENT:kotlin.String`) in order to use full screen intents.

Prior to `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#TIRAMISU:kotlin.Int`, the system may display a heads up notification (which may display on screen longer than other heads up notifications), instead of launching the intent, while the user is using the device. From `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#TIRAMISU:kotlin.Int`, the system UI will display a heads up notification, instead of launching this intent, while the user is using the device. This notification will display with emphasized action buttons. If the posting app holds `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#USE_FULL_SCREEN_INTENT:kotlin.String`, then the heads up notification will appear persistently until the user dismisses or snoozes it, or the app cancels it. If the posting app does not hold `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#USE_FULL_SCREEN_INTENT:kotlin.String`, then the notification will appear as heads up notification even when the screen is locked or turned off, and this notification will only be persistent for 60 seconds.

To be launched as a full screen intent, the notification must also be posted to a channel with importance level set to IMPORTANCE_HIGH or higher.
.   
Requires `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#USE_FULL_SCREEN_INTENT:kotlin.String`

| Parameters ||
|---|---|
| `intent` | [PendingIntent](https://developer.android.com/reference/kotlin/android/app/PendingIntent)!: the pending intent to launch |
| `highPriority` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): Passing `true` will cause this notification to be sent even if other notifications are suppressed |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/Notification#fullScreenIntent:android.app.PendingIntent`

### setGroup

Added in [API level 20](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setGroup(groupKey: String!): Notification.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/android/app/Notification.Builder#setGroupSummary(kotlin.Boolean)`. A sort order can be specified for group members by using `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setSortKey(kotlin.String)`.

| Parameters ||
|---|---|
| `groupKey` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: the group key of the group |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | this object for method chaining. This value cannot be `null`. |

### setGroupAlertBehavior

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setGroupAlertBehavior(groupAlertBehavior: Int): Notification.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/android/app/Notification.Builder#setGroup(kotlin.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 and/or peek on screen, all children in the group should have the group alert behavior `https://developer.android.com/reference/kotlin/android/app/Notification#GROUP_ALERT_SUMMARY:kotlin.Int`.

The default value is `https://developer.android.com/reference/kotlin/android/app/Notification#GROUP_ALERT_ALL:kotlin.Int`.

| Parameters ||
|---|---|
| `groupAlertBehavior` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/Notification#GROUP_ALERT_ALL:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/Notification#GROUP_ALERT_CHILDREN:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/Notification#GROUP_ALERT_SUMMARY:kotlin.Int` |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

### setGroupSummary

Added in [API level 20](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setGroupSummary(isGroupSummary: Boolean): Notification.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/android/app/Notification.Builder#setGroup(kotlin.String)`. The group summary may be suppressed if too few notifications are included in the group.

| Parameters ||
|---|---|
| `isGroupSummary` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): whether this notification should be a group summary |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | this object for method chaining. This value cannot be `null`. |

### setHasSummarizedContent

Added in [API level 36.1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setHasSummarizedContent(hasSummarizedContent: Boolean): Notification.Builder
```

Sets whether this notification contains text that was computationally summarized from other sources. The OS may choose to display this notification with different styling or choose not to summarize this content if this is true.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

### setLargeIcon

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setLargeIcon(b: Bitmap!): Notification.Builder
```

Add a large icon to the notification content view.

In the platform template, this image will be shown either on the right of the notification, with an aspect ratio of up to 16:9, or on the left when the notification is grouped.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

### setLargeIcon

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setLargeIcon(icon: Icon!): Notification.Builder
```

Add a large icon to the notification content view.

In the platform template, this image will be shown either on the right of the notification, with an aspect ratio of up to 16:9, or on the left when the notification is grouped.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

### setLights

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setLights(
    argb: Int, 
    onMs: Int, 
    offMs: Int
): Notification.Builder!
```

**Deprecated:** *use `https://developer.android.com/reference/kotlin/android/app/NotificationChannel#enableLights(kotlin.Boolean)` instead.*

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

Not all devices will honor all (or even any) of these values.
**See Also**

- `https://developer.android.com/reference/kotlin/android/app/Notification#ledARGB:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/Notification#ledOnMS:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/Notification#ledOffMS:kotlin.Int`

### setLocalOnly

Added in [API level 20](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setLocalOnly(localOnly: Boolean): Notification.Builder
```

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

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

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

### setLocusId

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setLocusId(locusId: LocusId?): Notification.Builder
```

Sets the `https://developer.android.com/reference/kotlin/android/content/LocusId.html#` associated with this notification.

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

| Parameters ||
|---|---|
| `locusId` | [LocusId](https://developer.android.com/reference/kotlin/android/content/LocusId.html#)?: This value may be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

### setNumber

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setNumber(number: Int): Notification.Builder
```

Sets the number of items this notification represents. May be displayed as a badge count for Launchers that support badging.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

### setOngoing

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setOngoing(ongoing: Boolean): Notification.Builder
```

Set whether this is an "ongoing" notification.

Ongoing notifications cannot be dismissed by the user on locked devices, or by notification listeners, and some notifications (call, device management, media) cannot be dismissed on unlocked devices, 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).

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/Notification#FLAG_ONGOING_EVENT:kotlin.Int`

### setOnlyAlertOnce

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setOnlyAlertOnce(onlyAlertOnce: Boolean): Notification.Builder
```

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

Note that using this flag will stop any ongoing alerting behaviour such as sound, vibration or blinking notification LED.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/Notification#FLAG_ONLY_ALERT_ONCE:kotlin.Int`

### setPriority

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setPriority(pri: Int): Notification.Builder!
```

**Deprecated:** *use `https://developer.android.com/reference/kotlin/android/app/NotificationChannel#setImportance(kotlin.Int)` instead.*

Set the priority of this notification.

| Parameters ||
|---|---|
| `pri` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/Notification#PRIORITY_DEFAULT:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/Notification#PRIORITY_LOW:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/Notification#PRIORITY_MIN:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/Notification#PRIORITY_HIGH:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/Notification#PRIORITY_MAX:kotlin.Int` |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/Notification#priority:kotlin.Int`

### setProgress

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

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

Set the progress this notification represents.

The platform template will represent this using a `https://developer.android.com/reference/kotlin/android/widget/ProgressBar.html#`.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

### setPublicVersion

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setPublicVersion(n: Notification!): Notification.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/kotlin/android/app/Notification#visibility:kotlin.Int` and `https://developer.android.com/reference/kotlin/android/app/Notification#VISIBILITY_PUBLIC:kotlin.Int`.

| Parameters ||
|---|---|
| `n` | [Notification](https://developer.android.com/reference/kotlin/android/app/Notification)!: a replacement notification, presumably with some or all info redacted |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | the same Builder. This value cannot be `null`. |

### setRemoteInputHistory

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setRemoteInputHistory(text: Array<CharSequence!>!): Notification.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/android/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`.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

### setRequestPromotedOngoing

Added in [API level 36.1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setRequestPromotedOngoing(requestPromotedOngoing: Boolean): Notification.Builder
```

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

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

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/Notification#EXTRA_REQUEST_PROMOTED_ONGOING:kotlin.String`
- `https://developer.android.com/reference/kotlin/android/app/Notification#isRequestPromotedOngoing()`

### setSettingsText

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setSettingsText(text: CharSequence!): Notification.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/android/app/Notification.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/android/app/Notification#INTENT_CATEGORY_NOTIFICATION_PREFERENCES:kotlin.String`.

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.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

### setShortCriticalText

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setShortCriticalText(shortCriticalText: String?): Notification.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/kotlin/android/app/Notification#FLAG_PROMOTED_ONGOING:kotlin.Int`.

- 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/android/app/Notification.MetricStyle`'s critical metric is the next option for the chip's content.
- A time (from `https://developer.android.com/reference/kotlin/android/app/Notification#when:kotlin.Long`) is the final source of content for the chip.
  - If `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setUsesChronometer(kotlin.Boolean)` is `true`, the chip content will be a chronometer, if that is positive (based on `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setChronometerCountDown(kotlin.Boolean)`).
  - If `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setShowWhen(kotlin.Boolean)` is true, the chip content will be the time remaining until `https://developer.android.com/reference/kotlin/android/app/Notification#when:kotlin.Long`, if positive.

| Parameters ||
|---|---|
| `shortCriticalText` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?: This value may be `null`. |

### setShortcutId

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setShortcutId(shortcutId: String!): Notification.Builder
```

From Android 11, messaging notifications (those that use `https://developer.android.com/reference/kotlin/android/app/Notification.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

<br />

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/android/app/Notification.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` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: the `https://developer.android.com/reference/kotlin/android/content/pm/ShortcutInfo.html#getId()` of the shortcut this notification is linked to |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/Notification.BubbleMetadata.Builder#Builder(kotlin.String)`

### setShowWhen

Added in [API level 17](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setShowWhen(show: Boolean): Notification.Builder
```

Control whether the timestamp set with `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setWhen(kotlin.Long)` is shown in the content view.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

### setSmallIcon

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setSmallIcon(icon: Icon!): Notification.Builder
```

Set the small icon, which will be used to represent the notification in the status bar.

| Parameters ||
|---|---|
| `icon` | [Icon](https://developer.android.com/reference/kotlin/android/graphics/drawable/Icon.html#)!: an Icon object to use |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/Notification#icon:kotlin.Int`

### setSmallIcon

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setSmallIcon(icon: Int): Notification.Builder
```

Set the small icon resource, which will be used to represent the notification in the status bar.

The platform template for the expanded view will draw this icon in the left, unless a `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setLargeIcon(android.graphics.Bitmap)` has also been specified, in which case the small icon will be moved to the right-hand side.

| Parameters ||
|---|---|
| `icon` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): A resource ID in the application's package of the drawable to use. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/Notification#icon:kotlin.Int`

### setSmallIcon

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

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

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

| Parameters ||
|---|---|
| `icon` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): a resource ID in the application's package of the drawable to use |
| `level` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): the level to use for the icon |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/Notification#icon:kotlin.Int`
- `https://developer.android.com/reference/kotlin/android/app/Notification#iconLevel:kotlin.Int`

### setSortKey

Added in [API level 20](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setSortKey(sortKey: String!): Notification.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/android/app/Notification.Builder#setGroup(kotlin.String)`.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

**See Also**

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

### setSound

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setSound(sound: Uri!): Notification.Builder!
```

**Deprecated:** *use `https://developer.android.com/reference/kotlin/android/app/NotificationChannel#setSound(android.net.Uri,%20android.media.AudioAttributes)` instead.*

Set the sound to play.

It will be played using the `https://developer.android.com/reference/kotlin/android/app/Notification#AUDIO_ATTRIBUTES_DEFAULT:android.media.AudioAttributes` for notifications.

### setSound

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setSound(
    sound: Uri!, 
    audioAttributes: AudioAttributes!
): Notification.Builder!
```

**Deprecated:** *use `https://developer.android.com/reference/kotlin/android/app/NotificationChannel#setSound(android.net.Uri,%20android.media.AudioAttributes)` instead.*

Set the sound to play, along with specific `https://developer.android.com/reference/kotlin/android/media/AudioAttributes.html#` to use during playback.
**See Also**

- `https://developer.android.com/reference/kotlin/android/app/Notification#sound:android.net.Uri`

### setSound

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setSound(
    sound: Uri!, 
    streamType: Int
): Notification.Builder!
```

**Deprecated:** *use `https://developer.android.com/reference/kotlin/android/app/NotificationChannel#setSound(android.net.Uri,%20android.media.AudioAttributes)`.*

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

See `https://developer.android.com/reference/kotlin/android/media/AudioManager.html#` for the `STREAM_` constants.

### setStyle

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setStyle(style: Notification.Style!): Notification.Builder
```

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

| Parameters ||
|---|---|
| `style` | [Notification.Style](https://developer.android.com/reference/kotlin/android/app/Notification.Style)!: object responsible for modifying the notification style |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

### setSubText

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setSubText(text: CharSequence!): Notification.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/kotlin/android/os/Build.VERSION_CODES.html#N:kotlin.Int` this information is displayed in the notification header area.

On Android versions before `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#N:kotlin.Int` 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/android/app/Notification.Builder#setProgress(kotlin.Int,%20kotlin.Int,%20kotlin.Boolean)` at the same time on those versions; they occupy the same place.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

### setTicker

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setTicker(tickerText: CharSequence!): Notification.Builder
```

Set the "ticker" text which is sent to accessibility services.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/Notification#tickerText:kotlin.CharSequence`

### setTicker

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setTicker(
    tickerText: CharSequence!, 
    views: RemoteViews!
): Notification.Builder!
```

**Deprecated:** *Deprecated in Java.*

Obsolete version of `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setTicker(kotlin.CharSequence)`.

### setTimeoutAfter

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setTimeoutAfter(durationMs: Long): Notification.Builder
```

Specifies a duration in milliseconds after which this notification should be canceled, if it is not already canceled.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

### setUsesChronometer

Added in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setUsesChronometer(b: Boolean): Notification.Builder
```

Show the `https://developer.android.com/reference/kotlin/android/app/Notification#when:kotlin.Long` 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).

The counter can also be set to count down to `when` when using `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setChronometerCountDown(kotlin.Boolean)`.

If the notification is `https://developer.android.com/reference/kotlin/android/app/Notification#FLAG_PROMOTED_ONGOING:kotlin.Int` then this stopwatch might also be displayed in its status bar chip.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/widget/Chronometer.html#`
- `https://developer.android.com/reference/kotlin/android/app/Notification#when:kotlin.Long`
- `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#setChronometerCountDown(kotlin.Boolean)`

### setVibrate

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setVibrate(pattern: LongArray!): Notification.Builder!
```

**Deprecated:** *use `https://developer.android.com/reference/kotlin/android/app/NotificationChannel#setVibrationPattern(kotlin.LongArray)` instead.*

Set the vibration pattern to use.

See `https://developer.android.com/reference/kotlin/android/os/Vibrator.html#vibrate(kotlin.LongArray,%20kotlin.Int)` for a discussion of the `pattern` parameter.

A notification that vibrates is more likely to be presented as a heads-up notification.
**See Also**

- `https://developer.android.com/reference/kotlin/android/app/Notification#vibrate:kotlin.LongArray`

### setVisibility

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setVisibility(visibility: Int): Notification.Builder
```

Specify the value of `https://developer.android.com/reference/kotlin/android/app/Notification#visibility:kotlin.Int`.

| Parameters ||
|---|---|
| `visibility` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/Notification#VISIBILITY_PUBLIC:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/Notification#VISIBILITY_PRIVATE:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/Notification#VISIBILITY_SECRET:kotlin.Int` |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | the same Builder. This value cannot be `null`. |

### setWhen

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setWhen(when: Long): Notification.Builder
```

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

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/Notification.Builder#` | This value cannot be `null`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/Notification#when:kotlin.Long`