# NotificationCompat.Builder

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1  
Summary:[Fields](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#lfields)\|[Ctors](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#pubctors)\|[Methods](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#pubmethods)\|[Protected Methods](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#promethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#)  

# NotificationCompat.Builder

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public
static


class
NotificationCompat.Builder
`  
`

extends Object


``


`

|---|---------------------------------------------------|
| java.lang.Object                                     ||
| ↳ | android.support.v4.app.NotificationCompat.Builder |

<br />

*** ** * ** ***

Builder class for[NotificationCompat](https://developer.android.com/reference/android/support/v4/app/NotificationCompat)objects. Allows easier control over all the flags, as well as help constructing the typical notification layouts.

On platform versions that don't offer expanded notifications, methods that depend on expanded notifications have no effect.

For example, action buttons won't appear on platforms prior to Android 4.1. Action buttons depend on expanded notifications, which are only available in Android 4.1 and later.

For this reason, you should always ensure that UI controls in a notification are also available in an[Activity](https://developer.android.com/reference/android/app/Activity.html)in your app, and you should always start that[Activity](https://developer.android.com/reference/android/app/Activity.html)when users click the notification. To do this, use the[setContentIntent()](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setContentIntent(android.app.PendingIntent))method.

<br />

## Summary

|                                                                                                            ### Fields                                                                                                             ||
|-----------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` public ArrayList<String>` | [mPeople](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#mPeople) *This field was deprecated in API level 27.1.0. This field was not meant to be public.* |

|                                                                                                                                                                                                                                                                                                     ### Public constructors                                                                                                                                                                                                                                                                                                      ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#NotificationCompat.Builder(android.content.Context, java.lang.String))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` context, String channelId) ` Constructor.                                                                                                                                                                                                                                                                                                 |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#NotificationCompat.Builder(android.content.Context))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` context) ` *This constructor was deprecated in API level 26.1.0. use[NotificationCompat.Builder(Context, String)](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#NotificationCompat.Builder(android.content.Context, java.lang.String))instead. All posted Notifications must specify a NotificationChannel Id.* |

|                                                                                                                                                                                                                                                                                                ### Public methods                                                                                                                                                                                                                                                                                                 ||
|----------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[addAction](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#addAction(android.support.v4.app.NotificationCompat.Action))`(`[NotificationCompat.Action](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Action)` action) ` Add an action to this notification.                                                                                                                                          |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[addAction](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#addAction(int, java.lang.CharSequence, android.app.PendingIntent))`(int icon, CharSequence title, `[PendingIntent](https://developer.android.com/reference/android/app/PendingIntent.html)` intent) ` Add an action to this notification.                                                                                                                                    |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[addExtras](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#addExtras(android.os.Bundle))`(`[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` extras) ` Merge additional metadata into this notification.                                                                                                                                                                                                        |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[addInvisibleAction](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#addInvisibleAction(android.support.v4.app.NotificationCompat.Action))`(`[NotificationCompat.Action](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Action)` action) ` Add an invisible action to this notification.                                                                                                              |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[addInvisibleAction](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#addInvisibleAction(int, java.lang.CharSequence, android.app.PendingIntent))`(int icon, CharSequence title, `[PendingIntent](https://developer.android.com/reference/android/app/PendingIntent.html)` intent) ` Add an invisible action to this notification.                                                                                                        |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[addPerson](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#addPerson(java.lang.String))`(String uri) ` Add a person that is relevant to this notification.                                                                                                                                                                                                                                                                              |
| ` `[Notification](https://developer.android.com/reference/android/app/Notification.html)                                   | ` `[build](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#build())`() ` Combine all of the options that have been set and return a new[Notification](https://developer.android.com/reference/android/app/Notification.html)object.                                                                                                                                                                                                         |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[extend](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#extend(android.support.v4.app.NotificationCompat.Extender))`(`[NotificationCompat.Extender](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Extender)` extender) ` Apply an extender to this notification builder.                                                                                                                            |
| ` `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)                                                | ` `[getExtras](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#getExtras())`() ` Get the current metadata Bundle used by this notification Builder.                                                                                                                                                                                                                                                                                         |
| ` `[Notification](https://developer.android.com/reference/android/app/Notification.html)                                   | ` `[getNotification](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#getNotification())`() ` *This method was deprecated in API level 22.1.0. Use[build()](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#build())instead.*                                                                                                                                                                      |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setAutoCancel](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setAutoCancel(boolean))`(boolean autoCancel) ` Setting this flag will make it so the notification is automatically canceled when the user clicks it in the panel.                                                                                                                                                                                                        |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setBadgeIconType](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setBadgeIconType(int))`(int icon) ` Sets which icon to display as a badge for this notification.                                                                                                                                                                                                                                                                      |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setCategory](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setCategory(java.lang.String))`(String category) ` Set the notification category.                                                                                                                                                                                                                                                                                          |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setChannelId](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setChannelId(java.lang.String))`(String channelId) ` Specifies the channel the notification should be delivered on.                                                                                                                                                                                                                                                       |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setColor](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setColor(int))`(int argb) ` Sets[color](https://developer.android.com/reference/android/app/Notification.html#color).                                                                                                                                                                                                                                                         |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setColorized](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setColorized(boolean))`(boolean colorize) ` Set whether this notification should be colorized.                                                                                                                                                                                                                                                                            |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setContent](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setContent(android.widget.RemoteViews))`(`[RemoteViews](https://developer.android.com/reference/android/widget/RemoteViews.html)` views) ` Supply a custom RemoteViews to use instead of the standard one.                                                                                                                                                                  |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setContentInfo](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setContentInfo(java.lang.CharSequence))`(CharSequence info) ` Set the large text at the right-hand side of the notification.                                                                                                                                                                                                                                            |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setContentIntent](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setContentIntent(android.app.PendingIntent))`(`[PendingIntent](https://developer.android.com/reference/android/app/PendingIntent.html)` intent) ` Supply a[PendingIntent](https://developer.android.com/reference/android/app/PendingIntent.html)to send when the notification is clicked.                                                                            |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setContentText](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setContentText(java.lang.CharSequence))`(CharSequence text) ` Set the text (second row) of the notification, in a standard notification.                                                                                                                                                                                                                                |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setContentTitle](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setContentTitle(java.lang.CharSequence))`(CharSequence title) ` Set the title (first row) of the notification, in a standard notification.                                                                                                                                                                                                                             |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setCustomBigContentView](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setCustomBigContentView(android.widget.RemoteViews))`(`[RemoteViews](https://developer.android.com/reference/android/widget/RemoteViews.html)` contentView) ` Supply custom RemoteViews to use instead of the platform template in the expanded form.                                                                                                          |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setCustomContentView](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setCustomContentView(android.widget.RemoteViews))`(`[RemoteViews](https://developer.android.com/reference/android/widget/RemoteViews.html)` contentView) ` Supply custom RemoteViews to use instead of the platform template.                                                                                                                                     |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setCustomHeadsUpContentView](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setCustomHeadsUpContentView(android.widget.RemoteViews))`(`[RemoteViews](https://developer.android.com/reference/android/widget/RemoteViews.html)` contentView) ` Supply custom RemoteViews to use instead of the platform template in the heads up dialog.                                                                                                |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setDefaults](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setDefaults(int))`(int defaults) ` Set the default notification options that will be used.                                                                                                                                                                                                                                                                                 |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setDeleteIntent](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setDeleteIntent(android.app.PendingIntent))`(`[PendingIntent](https://developer.android.com/reference/android/app/PendingIntent.html)` intent) ` Supply a[PendingIntent](https://developer.android.com/reference/android/app/PendingIntent.html)to send when the notification is cleared by the user directly from the notification panel.                             |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setExtras](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setExtras(android.os.Bundle))`(`[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` extras) ` Set metadata for this notification.                                                                                                                                                                                                                      |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setFullScreenIntent](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setFullScreenIntent(android.app.PendingIntent, boolean))`(`[PendingIntent](https://developer.android.com/reference/android/app/PendingIntent.html)` intent, boolean highPriority) ` An intent to launch instead of posting the notification to the status bar.                                                                                                     |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setGroup](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setGroup(java.lang.String))`(String groupKey) ` Set this notification to be part of a group of notifications sharing the same key.                                                                                                                                                                                                                                            |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setGroupAlertBehavior](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setGroupAlertBehavior(int))`(int groupAlertBehavior) ` Sets the group alert behavior for this notification.                                                                                                                                                                                                                                                      |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setGroupSummary](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setGroupSummary(boolean))`(boolean isGroupSummary) ` Set this notification to be the group summary for a group of notifications.                                                                                                                                                                                                                                       |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setLargeIcon](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setLargeIcon(android.graphics.Bitmap))`(`[Bitmap](https://developer.android.com/reference/android/graphics/Bitmap.html)` icon) ` Set the large icon that is shown in the ticker and notification.                                                                                                                                                                         |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setLights](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setLights(int, int, int))`(int argb, int onMs, int offMs) ` Set the argb value that you would like the LED on the device to blink, as well as the rate.                                                                                                                                                                                                                      |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setLocalOnly](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setLocalOnly(boolean))`(boolean b) ` Set whether or not this notification is only relevant to the current device.                                                                                                                                                                                                                                                         |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setNumber](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setNumber(int))`(int number) ` Set the large number at the right-hand side of the notification.                                                                                                                                                                                                                                                                              |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setOngoing](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setOngoing(boolean))`(boolean ongoing) ` Set whether this is an ongoing notification.                                                                                                                                                                                                                                                                                       |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setOnlyAlertOnce](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setOnlyAlertOnce(boolean))`(boolean onlyAlertOnce) ` Set this flag if you would only like the sound, vibrate and ticker to be played if the notification is not already showing.                                                                                                                                                                                      |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setPriority](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setPriority(int))`(int pri) ` Set the relative priority for this notification.                                                                                                                                                                                                                                                                                             |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setProgress](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setProgress(int, int, boolean))`(int max, int progress, boolean indeterminate) ` Set the progress this notification represents, which may be represented as a[ProgressBar](https://developer.android.com/reference/android/widget/ProgressBar.html).                                                                                                                       |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setPublicVersion](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setPublicVersion(android.app.Notification))`(`[Notification](https://developer.android.com/reference/android/app/Notification.html)` n) ` Supply a replacement Notification whose contents should be shown in insecure contexts (i.e.                                                                                                                                 |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setRemoteInputHistory](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setRemoteInputHistory(java.lang.CharSequence[]))`(CharSequence[] text) ` Set the remote input history.                                                                                                                                                                                                                                                           |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setShortcutId](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setShortcutId(java.lang.String))`(String shortcutId) ` If this notification is duplicative of a Launcher shortcut, sets the[id](https://developer.android.com/reference/android/support/v4/content/pm/ShortcutInfoCompat#getId())of the shortcut, in case the Launcher wants to hide the shortcut.                                                                       |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setShowWhen](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setShowWhen(boolean))`(boolean show) ` Control whether the timestamp set with[setWhen](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setWhen(long))is shown in the content view.                                                                                                                                               |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setSmallIcon](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setSmallIcon(int, int))`(int icon, int level) ` A variant of[setSmallIcon(int)](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setSmallIcon(int))that takes an additional level parameter for when the icon is a[LevelListDrawable](https://developer.android.com/reference/android/graphics/drawable/LevelListDrawable.html). |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setSmallIcon](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setSmallIcon(int))`(int icon) ` Set the small icon to use in the notification layouts.                                                                                                                                                                                                                                                                                    |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setSortKey](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setSortKey(java.lang.String))`(String sortKey) ` Set a sort key that orders this notification among other notifications from the same package.                                                                                                                                                                                                                              |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setSound](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setSound(android.net.Uri))`(`[Uri](https://developer.android.com/reference/android/net/Uri.html)` sound) ` Set the sound to play.                                                                                                                                                                                                                                             |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setSound](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setSound(android.net.Uri, int))`(`[Uri](https://developer.android.com/reference/android/net/Uri.html)` sound, int streamType) ` Set the sound to play.                                                                                                                                                                                                                        |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setStyle](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setStyle(android.support.v4.app.NotificationCompat.Style))`(`[NotificationCompat.Style](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Style)` style) ` Add a rich notification style to be applied at build time.                                                                                                                         |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setSubText](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setSubText(java.lang.CharSequence))`(CharSequence text) ` Set the third line of text in the platform notification template.                                                                                                                                                                                                                                                 |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setTicker](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setTicker(java.lang.CharSequence, android.widget.RemoteViews))`(CharSequence tickerText, `[RemoteViews](https://developer.android.com/reference/android/widget/RemoteViews.html)` views) ` Sets the "ticker" text which is sent to accessibility services.                                                                                                                   |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setTicker](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setTicker(java.lang.CharSequence))`(CharSequence tickerText) ` Sets the "ticker" text which is sent to accessibility services.                                                                                                                                                                                                                                               |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setTimeoutAfter](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setTimeoutAfter(long))`(long durationMs) ` Specifies the time at which this notification should be canceled, if it is not already canceled.                                                                                                                                                                                                                            |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setUsesChronometer](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setUsesChronometer(boolean))`(boolean b) ` Show the[when](https://developer.android.com/reference/android/app/Notification.html#when)field as a stopwatch.                                                                                                                                                                                                          |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setVibrate](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setVibrate(long[]))`(long[] pattern) ` Set the vibration pattern to use.                                                                                                                                                                                                                                                                                                    |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setVisibility](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setVisibility(int))`(int visibility) ` Sets[visibility](https://developer.android.com/reference/android/app/Notification.html#visibility).                                                                                                                                                                                                                               |
| ` `[NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | ` `[setWhen](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setWhen(long))`(long when) ` Set the time that the event occurred.                                                                                                                                                                                                                                                                                                             |

|                                                                                                ### Protected methods                                                                                                ||
|------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` static CharSequence` | ` `[limitCharSequenceLength](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#limitCharSequenceLength(java.lang.CharSequence))`(CharSequence cs) ` |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#)From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||

## Fields

### mPeople

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
ArrayList<String> mPeople
```

<br />

**This field was deprecated in API level 27.1.0.**   
This field was not meant to be public.

<br />

<br />

## Public constructors

### NotificationCompat.Builder

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder (Context context, 
                String channelId)
```

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

<br />

|                                                                                                              Parameters                                                                                                               ||
|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `context`   | `Context`: A[Context](https://developer.android.com/reference/android/content/Context.html)that will be used to construct the RemoteViews. The Context will not be held past the lifetime of this Builder object. <br /> |
| `channelId` | `String`: The constructed Notification will be posted on this NotificationChannel. <br />                                                                                                                                |

### NotificationCompat.Builder

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder (Context context)
```

<br />

**This constructor was deprecated in API level 26.1.0.**   
use[NotificationCompat.Builder(Context, String)](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#NotificationCompat.Builder(android.content.Context, java.lang.String))instead. All posted Notifications must specify a NotificationChannel Id.

<br />

<br />

|         Parameters          ||
|-----------|------------------|
| `context` | `Context` <br /> |

## Public methods

### addAction

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder addAction (NotificationCompat.Action action)
```

Add an action to this notification. Actions are typically displayed by the system as a button adjacent to the notification content.  
Action buttons won't appear on platforms prior to Android 4.1. Action buttons depend on expanded notifications, which are only available in Android 4.1 and later. To ensure that an action button's functionality is always available, first implement the functionality in the[Activity](https://developer.android.com/reference/android/app/Activity.html)that starts when a user clicks the notification (see[setContentIntent()](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setContentIntent(android.app.PendingIntent))), and then enhance the notification by implementing the same functionality with[addAction()](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#addAction(android.support.v4.app.NotificationCompat.Action)).

<br />

|                            Parameters                            ||
|----------|--------------------------------------------------------|
| `action` | `NotificationCompat.Action`: The action to add. <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### addAction

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder addAction (int icon, 
                CharSequence title, 
                PendingIntent intent)
```

Add an action to this notification. Actions are typically displayed by the system as a button adjacent to the notification content.  
Action buttons won't appear on platforms prior to Android 4.1. Action buttons depend on expanded notifications, which are only available in Android 4.1 and later. To ensure that an action button's functionality is always available, first implement the functionality in the[Activity](https://developer.android.com/reference/android/app/Activity.html)that starts when a user clicks the notification (see[setContentIntent()](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setContentIntent(android.app.PendingIntent))), and then enhance the notification by implementing the same functionality with[addAction()](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#addAction(android.support.v4.app.NotificationCompat.Action)).

<br />

|                                                                           Parameters                                                                            ||
|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------|
| `icon`   | `int`: Resource ID of a drawable that represents the action. <br />                                                                                   |
| `title`  | `CharSequence`: Text describing the action. <br />                                                                                                    |
| `intent` | `PendingIntent`:[PendingIntent](https://developer.android.com/reference/android/app/PendingIntent.html)to be fired when the action is invoked. <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### addExtras

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder addExtras (Bundle extras)
```

Merge additional metadata into this notification.

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

<br />

|        Parameters         ||
|----------|-----------------|
| `extras` | `Bundle` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

**See also:**

- [extras](https://developer.android.com/reference/android/app/Notification.html#extras)  

### addInvisibleAction

```
NotificationCompat.Builder addInvisibleAction (NotificationCompat.Action action)
```

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

<br />

|                            Parameters                            ||
|----------|--------------------------------------------------------|
| `action` | `NotificationCompat.Action`: The action to add. <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### addInvisibleAction

```
NotificationCompat.Builder addInvisibleAction (int icon, 
                CharSequence title, 
                PendingIntent intent)
```

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

<br />

|                                                                           Parameters                                                                            ||
|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------|
| `icon`   | `int`: Resource ID of a drawable that represents the action. <br />                                                                                   |
| `title`  | `CharSequence`: Text describing the action. <br />                                                                                                    |
| `intent` | `PendingIntent`:[PendingIntent](https://developer.android.com/reference/android/app/PendingIntent.html)to be fired when the action is invoked. <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### addPerson

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder addPerson (String uri)
```

Add a person that is relevant to this notification.

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

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

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

<br />

<br />

|                  Parameters                   ||
|-------|----------------------------------------|
| `uri` | `String`: A URI for the person. <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

**See also:**

- [EXTRA_PEOPLE](https://developer.android.com/reference/android/app/Notification.html#EXTRA_PEOPLE)  

### build

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
Notification build ()
```

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

<br />

|                                            Returns                                            ||
|---------------------------------------------------------------------------------------|--------|
| [Notification](https://developer.android.com/reference/android/app/Notification.html) | <br /> |

### extend

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

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

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

<br />

|                    Parameters                    ||
|------------|--------------------------------------|
| `extender` | `NotificationCompat.Extender` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### getExtras

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
Bundle getExtras ()
```

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[build()](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#build())is called.

<br />

|                                     Returns                                      ||
|--------------------------------------------------------------------------|--------|
| [Bundle](https://developer.android.com/reference/android/os/Bundle.html) | <br /> |

**See also:**

- [extras](https://developer.android.com/reference/android/app/Notification.html#extras)  

### getNotification

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
Notification getNotification ()
```

<br />

**This method was deprecated in API level 22.1.0.**   
Use[build()](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#build())instead.

<br />

<br />

|                                            Returns                                            ||
|---------------------------------------------------------------------------------------|--------|
| [Notification](https://developer.android.com/reference/android/app/Notification.html) | <br /> |

### setAutoCancel

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setAutoCancel (boolean autoCancel)
```

Setting this flag will make it so the notification is automatically canceled when the user clicks it in the panel. The PendingIntent set with[setDeleteIntent(PendingIntent)](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setDeleteIntent(android.app.PendingIntent))will be broadcast when the notification is canceled.

<br />

|           Parameters           ||
|--------------|------------------|
| `autoCancel` | `boolean` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setBadgeIconType

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setBadgeIconType (int icon)
```

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

Must be one of[BADGE_ICON_NONE](https://developer.android.com/reference/android/support/v4/app/NotificationCompat#BADGE_ICON_NONE),[BADGE_ICON_SMALL](https://developer.android.com/reference/android/support/v4/app/NotificationCompat#BADGE_ICON_SMALL),[BADGE_ICON_LARGE](https://developer.android.com/reference/android/support/v4/app/NotificationCompat#BADGE_ICON_LARGE).

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

<br />

|      Parameters      ||
|--------|--------------|
| `icon` | `int` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setCategory

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setCategory (String category)
```

Set the notification category.

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

<br />

|         Parameters          ||
|------------|-----------------|
| `category` | `String` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setChannelId

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

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

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

<br />

|          Parameters          ||
|-------------|-----------------|
| `channelId` | `String` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setColor

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setColor (int argb)
```

Sets[color](https://developer.android.com/reference/android/app/Notification.html#color).

<br />

|                  Parameters                   ||
|--------|---------------------------------------|
| `argb` | `int`: The accent color to use <br /> |

|                                                                      Returns                                                                      ||
|-------------------------------------------------------------------------------------------------------------------------|--------------------------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | The same Builder. <br /> |

### setColorized

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setColorized (boolean colorize)
```

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

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

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

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

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

<br />

|          Parameters          ||
|------------|------------------|
| `colorize` | `boolean` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

**See also:**

- [setColor(int)](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setColor(int))  

### setContent

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setContent (RemoteViews views)
```

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

<br />

|          Parameters           ||
|---------|----------------------|
| `views` | `RemoteViews` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setContentInfo

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setContentInfo (CharSequence info)
```

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

<br />

|          Parameters           ||
|--------|-----------------------|
| `info` | `CharSequence` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setContentIntent

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setContentIntent (PendingIntent intent)
```

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

<br />

|            Parameters            ||
|----------|------------------------|
| `intent` | `PendingIntent` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setContentText

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setContentText (CharSequence text)
```

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

<br />

|          Parameters           ||
|--------|-----------------------|
| `text` | `CharSequence` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setContentTitle

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setContentTitle (CharSequence title)
```

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

<br />

|           Parameters           ||
|---------|-----------------------|
| `title` | `CharSequence` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setCustomBigContentView

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setCustomBigContentView (RemoteViews contentView)
```

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

<br />

|             Parameters              ||
|---------------|----------------------|
| `contentView` | `RemoteViews` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setCustomContentView

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setCustomContentView (RemoteViews contentView)
```

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

<br />

|             Parameters              ||
|---------------|----------------------|
| `contentView` | `RemoteViews` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setCustomHeadsUpContentView

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setCustomHeadsUpContentView (RemoteViews contentView)
```

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

<br />

|             Parameters              ||
|---------------|----------------------|
| `contentView` | `RemoteViews` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setDefaults

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setDefaults (int defaults)
```

Set the default notification options that will be used.

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

For all default values, use[DEFAULT_ALL](https://developer.android.com/reference/android/app/Notification.html#DEFAULT_ALL).

<br />

|        Parameters        ||
|------------|--------------|
| `defaults` | `int` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setDeleteIntent

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setDeleteIntent (PendingIntent intent)
```

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

<br />

|            Parameters            ||
|----------|------------------------|
| `intent` | `PendingIntent` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setExtras

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setExtras (Bundle extras)
```

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[build()](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#build())is called.

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

<br />

|        Parameters         ||
|----------|-----------------|
| `extras` | `Bundle` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

**See also:**

- [extras](https://developer.android.com/reference/android/app/Notification.html#extras)  

### setFullScreenIntent

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setFullScreenIntent (PendingIntent intent, 
                boolean highPriority)
```

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

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

<br />

<br />

|                                                             Parameters                                                             ||
|----------------|--------------------------------------------------------------------------------------------------------------------|
| `intent`       | `PendingIntent`: The pending intent to launch. <br />                                                              |
| `highPriority` | `boolean`: Passing true will cause this notification to be sent even if other notifications are suppressed. <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setGroup

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setGroup (String groupKey)
```

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[setGroupSummary(boolean)](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setGroupSummary(boolean)). A sort order can be specified for group members by using[setSortKey(String)](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setSortKey(java.lang.String)).

<br />

|                        Parameters                        ||
|------------|----------------------------------------------|
| `groupKey` | `String`: The group key of the group. <br /> |

|                                                                             Returns                                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|----------------------------------------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | this object for method chaining <br /> |

### setGroupAlertBehavior

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setGroupAlertBehavior (int groupAlertBehavior)
```

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[group](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setGroup(java.lang.String)). This must be called on all notifications you want to mute. For example, if you want only the summary of your group to make noise, all children in the group should have the group alert behavior[GROUP_ALERT_SUMMARY](https://developer.android.com/reference/android/support/v4/app/NotificationCompat#GROUP_ALERT_SUMMARY).

The default value is[GROUP_ALERT_ALL](https://developer.android.com/reference/android/support/v4/app/NotificationCompat#GROUP_ALERT_ALL).

<br />

<br />

|             Parameters             ||
|----------------------|--------------|
| `groupAlertBehavior` | `int` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setGroupSummary

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setGroupSummary (boolean isGroupSummary)
```

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[setGroup(String)](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setGroup(java.lang.String)).

<br />

|                                        Parameters                                        ||
|------------------|------------------------------------------------------------------------|
| `isGroupSummary` | `boolean`: Whether this notification should be a group summary. <br /> |

|                                                                             Returns                                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|----------------------------------------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | this object for method chaining <br /> |

### setLargeIcon

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setLargeIcon (Bitmap icon)
```

Set the large icon that is shown in the ticker and notification.

<br />

|       Parameters        ||
|--------|-----------------|
| `icon` | `Bitmap` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setLights

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setLights (int argb, 
                int onMs, 
                int offMs)
```

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

<br />

|      Parameters       ||
|---------|--------------|
| `argb`  | `int` <br /> |
| `onMs`  | `int` <br /> |
| `offMs` | `int` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setLocalOnly

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setLocalOnly (boolean b)
```

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

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

<br />

|      Parameters       ||
|-----|------------------|
| `b` | `boolean` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setNumber

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setNumber (int number)
```

Set the large number at the right-hand side of the notification. This is equivalent to setContentInfo, although it might show the number in a different font size for readability.

<br />

|       Parameters       ||
|----------|--------------|
| `number` | `int` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setOngoing

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setOngoing (boolean ongoing)
```

Set whether this is an ongoing notification.

Ongoing notifications differ from regular notifications in the following ways:

- Ongoing notifications are sorted above the regular notifications in the notification panel.
- Ongoing notifications do not have an 'X' close button, and are not affected by the "Clear all" button.

<br />

<br />

|         Parameters          ||
|-----------|------------------|
| `ongoing` | `boolean` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setOnlyAlertOnce

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setOnlyAlertOnce (boolean onlyAlertOnce)
```

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

<br />

|            Parameters             ||
|-----------------|------------------|
| `onlyAlertOnce` | `boolean` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setPriority

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setPriority (int pri)
```

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

<br />

|                                                                                                                                                                                                                                         Parameters                                                                                                                                                                                                                                         ||
|-------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `pri` | `int`: Relative priority for this notification. Must be one of the priority constants defined by[NotificationCompat](https://developer.android.com/reference/android/support/v4/app/NotificationCompat). Acceptable values range from[PRIORITY_MIN](https://developer.android.com/reference/android/support/v4/app/NotificationCompat#PRIORITY_MIN)(-2) to[PRIORITY_MAX](https://developer.android.com/reference/android/support/v4/app/NotificationCompat#PRIORITY_MAX)(2). <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setProgress

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setProgress (int max, 
                int progress, 
                boolean indeterminate)
```

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

<br />

|            Parameters             ||
|-----------------|------------------|
| `max`           | `int` <br />     |
| `progress`      | `int` <br />     |
| `indeterminate` | `boolean` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setPublicVersion

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setPublicVersion (Notification n)
```

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

<br />

|                                             Parameters                                             ||
|-----|-----------------------------------------------------------------------------------------------|
| `n` | `Notification`: A replacement notification, presumably with some or all info redacted. <br /> |

|                                                                      Returns                                                                      ||
|-------------------------------------------------------------------------------------------------------------------------|--------------------------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | The same Builder. <br /> |

### setRemoteInputHistory

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setRemoteInputHistory (CharSequence[] text)
```

Set the remote input history. This should be set to the most recent inputs that have been sent through a[RemoteInput](https://developer.android.com/reference/android/support/v4/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`.

<br />

<br />

|          Parameters           ||
|--------|-----------------------|
| `text` | `CharSequence` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setShortcutId

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setShortcutId (String shortcutId)
```

If this notification is duplicative of a Launcher shortcut, sets the[id](https://developer.android.com/reference/android/support/v4/content/pm/ShortcutInfoCompat#getId())of the shortcut, in case the Launcher wants to hide the shortcut.

**Note:** This field will be ignored by Launchers that don't support badging or[shortcuts](https://developer.android.com/reference/android/support/v4/content/pm/ShortcutManagerCompat).

<br />

|                                                                                      Parameters                                                                                      ||
|--------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `shortcutId` | `String`: the[id](https://developer.android.com/reference/android/support/v4/content/pm/ShortcutInfoCompat#getId())of the shortcut this notification supersedes <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setShowWhen

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setShowWhen (boolean show)
```

Control whether the timestamp set with[setWhen](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setWhen(long))is shown in the content view.

<br />

|        Parameters        ||
|--------|------------------|
| `show` | `boolean` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setSmallIcon

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setSmallIcon (int icon, 
                int level)
```

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

<br />

|                                        Parameters                                         ||
|---------|----------------------------------------------------------------------------------|
| `icon`  | `int`: A resource ID in the application's package of the drawable to use. <br /> |
| `level` | `int`: The level to use for the icon. <br />                                     |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

**See also:**

- [LevelListDrawable](https://developer.android.com/reference/android/graphics/drawable/LevelListDrawable.html)  

### setSmallIcon

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setSmallIcon (int icon)
```

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

<br />

|                                        Parameters                                        ||
|--------|----------------------------------------------------------------------------------|
| `icon` | `int`: A resource ID in the application's package of the drawable to use. <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setSortKey

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setSortKey (String sortKey)
```

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[setGroup(String)](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setGroup(java.lang.String)).

<br />

|         Parameters         ||
|-----------|-----------------|
| `sortKey` | `String` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

**See also:**

- [compareTo(String)](https://developer.android.com/reference/java/lang/String#compareTo(java.lang.String))  

### setSound

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setSound (Uri sound)
```

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

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

<br />

<br />

|      Parameters       ||
|---------|--------------|
| `sound` | `Uri` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setSound

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setSound (Uri sound, 
                int streamType)
```

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

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

<br />

<br />

|         Parameters         ||
|--------------|--------------|
| `sound`      | `Uri` <br /> |
| `streamType` | `int` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

**See also:**

- [STREAM_DEFAULT](https://developer.android.com/reference/android/app/Notification.html#STREAM_DEFAULT)
- [for the `STREAM_` constants.](https://developer.android.com/reference/android/media/AudioManager.html)  

### setStyle

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setStyle (NotificationCompat.Style style)
```

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

<br />

|                                              Parameters                                              ||
|---------|---------------------------------------------------------------------------------------------|
| `style` | `NotificationCompat.Style`: Object responsible for modifying the notification style. <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setSubText

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setSubText (CharSequence text)
```

Set the third line of text in the platform notification template. Don't use if you're also using[setProgress(int, int, boolean)](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder#setProgress(int, int, boolean)); they occupy the same location in the standard template.  
If the platform does not provide large-format notifications, this method has no effect. The third line of text only appears in expanded view.  

<br />

|          Parameters           ||
|--------|-----------------------|
| `text` | `CharSequence` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setTicker

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setTicker (CharSequence tickerText, 
                RemoteViews views)
```

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

<br />

|             Parameters              ||
|--------------|-----------------------|
| `tickerText` | `CharSequence` <br /> |
| `views`      | `RemoteViews` <br />  |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setTicker

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setTicker (CharSequence tickerText)
```

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

<br />

|             Parameters              ||
|--------------|-----------------------|
| `tickerText` | `CharSequence` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setTimeoutAfter

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setTimeoutAfter (long durationMs)
```

Specifies the time at which this notification should be canceled, if it is not already canceled.

<br />

|         Parameters          ||
|--------------|---------------|
| `durationMs` | `long` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setUsesChronometer

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setUsesChronometer (boolean b)
```

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

<br />

|      Parameters       ||
|-----|------------------|
| `b` | `boolean` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

**See also:**

- [Chronometer](https://developer.android.com/reference/android/widget/Chronometer.html)
- [when](https://developer.android.com/reference/android/app/Notification.html#when)  

### setVibrate

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setVibrate (long[] pattern)
```

Set the vibration pattern to use.

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

<br />

<br />

|        Parameters        ||
|-----------|---------------|
| `pattern` | `long` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

**See also:**

- [for a discussion of the `pattern`
parameter.](https://developer.android.com/reference/android/os/Vibrator.html)  

### setVisibility

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setVisibility (int visibility)
```

Sets[visibility](https://developer.android.com/reference/android/app/Notification.html#visibility).

<br />

|                                                                                                                                                                                         Parameters                                                                                                                                                                                          ||
|--------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `visibility` | `int`: One of[VISIBILITY_PRIVATE](https://developer.android.com/reference/android/app/Notification.html#VISIBILITY_PRIVATE)(the default),[VISIBILITY_PUBLIC](https://developer.android.com/reference/android/app/Notification.html#VISIBILITY_PUBLIC), or[VISIBILITY_SECRET](https://developer.android.com/reference/android/app/Notification.html#VISIBILITY_SECRET). <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

### setWhen

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
NotificationCompat.Builder setWhen (long when)
```

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

<br />

|      Parameters       ||
|--------|---------------|
| `when` | `long` <br /> |

|                                                             Returns                                                             ||
|-------------------------------------------------------------------------------------------------------------------------|--------|
| [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder) | <br /> |

## Protected methods

### limitCharSequenceLength

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
CharSequence limitCharSequenceLength (CharSequence cs)
```

<br />

<br />

|         Parameters          ||
|------|-----------------------|
| `cs` | `CharSequence` <br /> |

|        Returns         ||
|----------------|--------|
| `CharSequence` | <br /> |

-

  ## Annotations

  - [NotificationCompat.Action.SemanticAction](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Action.SemanticAction)
-

  ## Interfaces

  - [ActionBarDrawerToggle.Delegate](https://developer.android.com/reference/android/support/v4/app/ActionBarDrawerToggle.Delegate)
  - [ActionBarDrawerToggle.DelegateProvider](https://developer.android.com/reference/android/support/v4/app/ActionBarDrawerToggle.DelegateProvider)
  - [ActivityCompat.OnRequestPermissionsResultCallback](https://developer.android.com/reference/android/support/v4/app/ActivityCompat.OnRequestPermissionsResultCallback)
  - [ActivityCompat.PermissionCompatDelegate](https://developer.android.com/reference/android/support/v4/app/ActivityCompat.PermissionCompatDelegate)
  - [FragmentManager.BackStackEntry](https://developer.android.com/reference/android/support/v4/app/FragmentManager.BackStackEntry)
  - [FragmentManager.OnBackStackChangedListener](https://developer.android.com/reference/android/support/v4/app/FragmentManager.OnBackStackChangedListener)
  - [LoaderManager.LoaderCallbacks](https://developer.android.com/reference/android/support/v4/app/LoaderManager.LoaderCallbacks)
  - [NotificationCompat.Action.Extender](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Action.Extender)
  - [NotificationCompat.Extender](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Extender)
  - [SharedElementCallback.OnSharedElementsReadyListener](https://developer.android.com/reference/android/support/v4/app/SharedElementCallback.OnSharedElementsReadyListener)
  - [TaskStackBuilder.SupportParentable](https://developer.android.com/reference/android/support/v4/app/TaskStackBuilder.SupportParentable)
-

  ## Classes

  - [ActionBarDrawerToggle](https://developer.android.com/reference/android/support/v4/app/ActionBarDrawerToggle)
  - [ActivityCompat](https://developer.android.com/reference/android/support/v4/app/ActivityCompat)
  - [ActivityManagerCompat](https://developer.android.com/reference/android/support/v4/app/ActivityManagerCompat)
  - [ActivityOptionsCompat](https://developer.android.com/reference/android/support/v4/app/ActivityOptionsCompat)
  - [AlarmManagerCompat](https://developer.android.com/reference/android/support/v4/app/AlarmManagerCompat)
  - [AppLaunchChecker](https://developer.android.com/reference/android/support/v4/app/AppLaunchChecker)
  - [AppOpsManagerCompat](https://developer.android.com/reference/android/support/v4/app/AppOpsManagerCompat)
  - [BundleCompat](https://developer.android.com/reference/android/support/v4/app/BundleCompat)
  - [DialogFragment](https://developer.android.com/reference/android/support/v4/app/DialogFragment)
  - [Fragment](https://developer.android.com/reference/android/support/v4/app/Fragment)
  - [Fragment.SavedState](https://developer.android.com/reference/android/support/v4/app/Fragment.SavedState)
  - [FragmentActivity](https://developer.android.com/reference/android/support/v4/app/FragmentActivity)
  - [FragmentContainer](https://developer.android.com/reference/android/support/v4/app/FragmentContainer)
  - [FragmentController](https://developer.android.com/reference/android/support/v4/app/FragmentController)
  - [FragmentHostCallback](https://developer.android.com/reference/android/support/v4/app/FragmentHostCallback)
  - [FragmentManager](https://developer.android.com/reference/android/support/v4/app/FragmentManager)
  - [FragmentManager.FragmentLifecycleCallbacks](https://developer.android.com/reference/android/support/v4/app/FragmentManager.FragmentLifecycleCallbacks)
  - [FragmentManagerNonConfig](https://developer.android.com/reference/android/support/v4/app/FragmentManagerNonConfig)
  - [FragmentPagerAdapter](https://developer.android.com/reference/android/support/v4/app/FragmentPagerAdapter)
  - [FragmentStatePagerAdapter](https://developer.android.com/reference/android/support/v4/app/FragmentStatePagerAdapter)
  - [FragmentTabHost](https://developer.android.com/reference/android/support/v4/app/FragmentTabHost)
  - [FragmentTransaction](https://developer.android.com/reference/android/support/v4/app/FragmentTransaction)
  - [FrameMetricsAggregator](https://developer.android.com/reference/android/support/v4/app/FrameMetricsAggregator)
  - [JobIntentService](https://developer.android.com/reference/android/support/v4/app/JobIntentService)
  - [ListFragment](https://developer.android.com/reference/android/support/v4/app/ListFragment)
  - [LoaderManager](https://developer.android.com/reference/android/support/v4/app/LoaderManager)
  - [NavUtils](https://developer.android.com/reference/android/support/v4/app/NavUtils)
  - [NotificationCompat](https://developer.android.com/reference/android/support/v4/app/NotificationCompat)
  - [NotificationCompat.Action](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Action)
  - [NotificationCompat.Action.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Action.Builder)
  - [NotificationCompat.Action.WearableExtender](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Action.WearableExtender)
  - [NotificationCompat.BigPictureStyle](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.BigPictureStyle)
  - [NotificationCompat.BigTextStyle](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.BigTextStyle)
  - [NotificationCompat.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder)
  - [NotificationCompat.CarExtender](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.CarExtender)
  - [NotificationCompat.CarExtender.UnreadConversation](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.CarExtender.UnreadConversation)
  - [NotificationCompat.CarExtender.UnreadConversation.Builder](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.CarExtender.UnreadConversation.Builder)
  - [NotificationCompat.DecoratedCustomViewStyle](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.DecoratedCustomViewStyle)
  - [NotificationCompat.InboxStyle](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.InboxStyle)
  - [NotificationCompat.MessagingStyle](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.MessagingStyle)
  - [NotificationCompat.MessagingStyle.Message](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.MessagingStyle.Message)
  - [NotificationCompat.Style](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Style)
  - [NotificationCompat.WearableExtender](https://developer.android.com/reference/android/support/v4/app/NotificationCompat.WearableExtender)
  - [NotificationCompatExtras](https://developer.android.com/reference/android/support/v4/app/NotificationCompatExtras)
  - [NotificationCompatSideChannelService](https://developer.android.com/reference/android/support/v4/app/NotificationCompatSideChannelService)
  - [NotificationManagerCompat](https://developer.android.com/reference/android/support/v4/app/NotificationManagerCompat)
  - [RemoteInput](https://developer.android.com/reference/android/support/v4/app/RemoteInput)
  - [RemoteInput.Builder](https://developer.android.com/reference/android/support/v4/app/RemoteInput.Builder)
  - [ServiceCompat](https://developer.android.com/reference/android/support/v4/app/ServiceCompat)
  - [ShareCompat](https://developer.android.com/reference/android/support/v4/app/ShareCompat)
  - [ShareCompat.IntentBuilder](https://developer.android.com/reference/android/support/v4/app/ShareCompat.IntentBuilder)
  - [ShareCompat.IntentReader](https://developer.android.com/reference/android/support/v4/app/ShareCompat.IntentReader)
  - [SharedElementCallback](https://developer.android.com/reference/android/support/v4/app/SharedElementCallback)
  - [TaskStackBuilder](https://developer.android.com/reference/android/support/v4/app/TaskStackBuilder)
-

  ## Exceptions

  - [Fragment.InstantiationException](https://developer.android.com/reference/android/support/v4/app/Fragment.InstantiationException)