The Android Developer Challenge is back! Submit your idea before December 2.

NotificationCompat

open class NotificationCompat
kotlin.Any
   ↳ androidx.core.app.NotificationCompat

Helper for accessing features in android.app.Notification.

Summary

Nested classes

open

Structure to encapsulate a named action that can be shown as part of this notification.

open

Helper class for generating large-format notifications that include a large image attachment.

open

Helper class for generating large-format notifications that include a lot of text.

Encapsulates the information needed to display a notification as a bubble.

open

Builder class for NotificationCompat objects.

Helper class to add Android Auto extensions to notifications.

open

Notification style for custom views that are decorated by the system.

abstract

Extender interface for use with Builder#extend.

open

Helper class for generating large-format notifications that include a list of (up to 5) strings.

open

Helper class for generating large-format notifications that include multiple back-and-forth messages of varying types between any number of people.

abstract

An object that can apply a rich notification style to a Notification.Builder object.

Helper class to add wearable extensions to notifications.

Constants

static Int

If this notification is being shown as a badge, use the icon provided to Builder#setLargeIcon(Bitmap) to represent this notification.

static Int

If this notification is being shown as a badge, always show as a number.

static Int

If this notification is being shown as a badge, use the icon provided to Builder#setSmallIcon(int) to represent this notification.

static String

Notification category: alarm or timer.

static String

Notification category: incoming call (voice or video) or similar synchronous communication request.

static String

Notification category: asynchronous bulk message (email).

static String

Notification category: error in background operation or authentication status.

static String

Notification category: calendar event.

static String

Notification category: incoming direct message (SMS, instant message, etc.).

static String

Notification category: map turn-by-turn navigation.

static String

Notification category: progress of a long-running background operation.

static String

Notification category: promotion or advertisement.

static String

Notification category: a specific, timely recommendation for a single thing.

static String

Notification category: user-scheduled reminder.

static String

Notification category: indication of running background service.

static String

Notification category: social network or sharing update.

static String

Notification category: ongoing information about device or contextual status.

static String

Notification category: system or device status update.

static String

Notification category: media transport control for playback.

static Int

Value of Notification#color equal to 0 (also known as Color.TRANSPARENT), telling the system not to decorate this notification with any special color but instead use default colors when presenting this notification.

static Int

Use all default values (where applicable).

static Int

Use the default notification lights.

static Int

Use the default notification sound.

static Int

Use the default notification vibrate.

static String

Keys into the getExtras Bundle: the audio contents of this notification.

static String

Notification extras key: A content URI pointing to an image that can be displayed in the background when the notification is selected.

static String

Notification extras key: this is the longer text shown in the big form of a BigTextStyle notification, as supplied to BigTextStyle#bigText(CharSequence).

static String

Notification extras key: whether the chronometer set on the notification should count down instead of counting up.

static String

Notification extras key: the indices of actions to be shown in the compact view, as supplied to (e.g.)

static String

Notification key: a String to be displayed as the title to a conversation represented by a MessagingStyle.

static String

Key for compat's MessagingStyle#getConversationTitle().

static String

Notification extras key: this is a small piece of additional text as supplied to Builder#setContentInfo(CharSequence).

static String

Notification key: whether the NotificationCompat.MessagingStyle notification represents a group conversation.

static String

Notification extras key: this is a bitmap to be used instead of the small icon when showing the notification payload, as supplied to Builder#setLargeIcon(android.graphics.Bitmap).

static String

Notification extras key: this is a bitmap to be used instead of the one from Builder#setLargeIcon(android.graphics.Bitmap) when the notification is shown in its expanded form, as supplied to BigPictureStyle#bigLargeIcon(android.graphics.Bitmap).

static String

Notification key: A android.media.session.MediaSession.Token associated with a android.app.Notification.MediaStyle notification.

static String

Notification key: an array of Bundle objects representing MessagingStyle.Message objects for a MessagingStyle notification.

static String

Notification key: the person to display for all messages sent by the user, including direct replies to MessagingStyle notifications.

static String

Notification extras key: A String array containing the people that this notification relates to, each of which was supplied to Builder#addPerson(String).

static String

Notification extras key: this is a bitmap to be shown in BigPictureStyle expanded notifications, supplied to BigPictureStyle#bigPicture(android.graphics.Bitmap).

static String

Notification extras key: this is the progress value supplied to Builder#setProgress(int, int, boolean).

static String

Notification extras key: whether the progress bar is indeterminate, supplied to Builder#setProgress(int, int, boolean).

static String

Notification extras key: this is the maximum value supplied to Builder#setProgress(int, int, boolean).

static String

Notification extras key: this is the remote input history, as supplied to Builder#setRemoteInputHistory(CharSequence[]).

static String

Notification key: the username to be displayed for all messages sent by the user including direct replies MessagingStyle notification.

static String

Notification extras key: whether the when field set using Builder#setWhen should be shown as a count-up timer (specifically a android.widget.Chronometer) instead of a timestamp, as supplied to Builder#setUsesChronometer(boolean).

static String

Notification extras key: whether the when field set using Builder#setWhen should be shown, as supplied to Builder#setShowWhen(boolean).

static String

Notification extras key: this is the resource ID of the notification's main small icon, as supplied to Builder#setSmallIcon(int).

static String

Notification extras key: this is a third line of text, as supplied to Builder#setSubText(CharSequence).

static String

Notification extras key: this is a line of summary information intended to be shown alongside expanded notifications, as supplied to (e.g.)

static String

Notification extras key: A string representing the name of the specific android.app.Notification.Style used to create this notification.

static String

Notification extras key: this is the main text payload, as supplied to Builder#setContentText(CharSequence).

static String

Notification extras key: An array of CharSequences to show in InboxStyle expanded notifications, each of which was supplied to InboxStyle#addLine(CharSequence).

static String

Notification extras key: this is the title of the notification, as supplied to Builder#setContentTitle(CharSequence).

static String

Notification extras key: this is the title of the notification when shown in expanded form, e.

static Int

Bit set in the Notification flags field if the notification should be canceled when it is clicked by the user.

static Int

Bit set in the Notification flags field if this notification is showing as a bubble.

static Int

Bit set in the Notification flags field if this notification represents a currently running service.

static Int

Bit set in the Notification flags field if this notification is the group summary for a group of notifications.

static Int

Obsolete flag indicating high-priority notifications; use the priority field instead.

static Int

Bit set in the Notification flags field if the audio will be repeated until the notification is cancelled or the notification window is opened.

static Int

Bit set in the Notification flags field if this notification is relevant to the current device only and it is not recommended that it bridge to other devices.

static Int

Bit set in the Notification flags field if the notification should not be canceled when the user clicks the Clear all button.

static Int

Bit set in the Notification flags field if this notification is in reference to something that is ongoing, like a phone call.

static Int

Bit set in the Notification flags field if the notification's sound, vibrate and ticker should only be played if the notification is not already showing.

static Int

Bit set in the Notification flags field when LEDs should be turned on for this notification.

static Int

Constant for Builder#setGroupAlertBehavior(int), meaning that all notifications in a group with sound or vibration ought to make sound or vibrate (respectively), so this notification will not be muted when it is in a group.

static Int

Constant for Builder#setGroupAlertBehavior(int), meaning that the summary notification in a group should be silenced (no sound or vibration) even if they would otherwise make sound or vibrate.

static Int

Constant for Builder#setGroupAlertBehavior(int), meaning that all children notification in a group should be silenced (no sound or vibration) even if they would otherwise make sound or vibrate.

static Int

Default notification priority for NotificationCompat.Builder#setPriority(int).

static Int

Higher notification priority for NotificationCompat.Builder#setPriority(int), for more important notifications or alerts.

static Int

Lower notification priority for NotificationCompat.Builder#setPriority(int), for items that are less important.

static Int

Highest notification priority for NotificationCompat.Builder#setPriority(int), for your application's most important items that require the user's prompt attention or input.

static Int

Lowest notification priority for NotificationCompat.Builder#setPriority(int); these items might not be shown to the user except under special circumstances, such as detailed notification logs.

static Int

Use this constant as the value for audioStreamType to request that the default stream type for notifications be used.

static Int

Notification visibility: Show this notification on all lockscreens, but conceal sensitive or private information on secure lockscreens.

static Int

Notification visibility: Show this notification in its entirety on all lockscreens.

static Int

Notification visibility: Do not reveal any part of this notification on a secure lockscreen.

Public constructors

Public methods

open static NotificationCompat.Action!
getAction(notification: Notification!, actionIndex: Int)

Get an action on this notification in a backwards compatible manner.

open static Int
getActionCount(notification: Notification!)

Get the number of actions in this notification in a backwards compatible manner.

open static Boolean

Returns whether the platform is allowed (by the app developer) to generate contextual actions for this notification.

open static Int

Returns what icon should be shown for this notification if it is being displayed in a Launcher that supports badging.

open static NotificationCompat.BubbleMetadata?
getBubbleMetadata(@NonNull notification: Notification)

Get the BubbleMetadata for a notification that will be used to display app content in a floating window over the existing foreground activity.

open static String!
getCategory(notification: Notification!)

Get the category of this notification in a backwards compatible manner.

open static String!
getChannelId(notification: Notification!)

open static CharSequence!
getContentTitle(notification: Notification!)

Returns the content title of a Notification.

open static Bundle?
getExtras(notification: Notification!)

Gets the Notification#extras field from a notification in a backwards compatible manner.

open static String!
getGroup(notification: Notification!)

Get the key used to group this notification into a cluster or stack with other notifications on devices which support such rendering.

open static Int

Returns which type of notifications in a group are responsible for audibly alerting the user.

open static MutableList<NotificationCompat.Action!>!

Returns the invisible actions contained within the given notification.

open static Boolean
getLocalOnly(notification: Notification!)

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

open static String!
getShortcutId(notification: Notification!)

Returns the id that this notification supersedes, if any.

open static String!
getSortKey(notification: Notification!)

Get a sort key that orders this notification among other notifications from the same package.

open static Long
getTimeoutAfter(notification: Notification!)

Returns the time at which this notification should be canceled by the system, if it's not canceled already.

open static Boolean
isGroupSummary(notification: Notification!)

Get whether this notification to be the group summary for a group of notifications.

Constants

BADGE_ICON_LARGE

static val BADGE_ICON_LARGE: Int

If this notification is being shown as a badge, use the icon provided to Builder#setLargeIcon(Bitmap) to represent this notification.

Value: Notification.BADGE_ICON_LARGE

BADGE_ICON_NONE

static val BADGE_ICON_NONE: Int

If this notification is being shown as a badge, always show as a number.

Value: Notification.BADGE_ICON_NONE

BADGE_ICON_SMALL

static val BADGE_ICON_SMALL: Int

If this notification is being shown as a badge, use the icon provided to Builder#setSmallIcon(int) to represent this notification.

Value: Notification.BADGE_ICON_SMALL

CATEGORY_ALARM

static val CATEGORY_ALARM: String

Notification category: alarm or timer.

Value: Notification.CATEGORY_ALARM

CATEGORY_CALL

static val CATEGORY_CALL: String

Notification category: incoming call (voice or video) or similar synchronous communication request.

Value: Notification.CATEGORY_CALL

CATEGORY_EMAIL

static val CATEGORY_EMAIL: String

Notification category: asynchronous bulk message (email).

Value: Notification.CATEGORY_EMAIL

CATEGORY_ERROR

static val CATEGORY_ERROR: String

Notification category: error in background operation or authentication status.

Value: Notification.CATEGORY_ERROR

CATEGORY_EVENT

static val CATEGORY_EVENT: String

Notification category: calendar event.

Value: Notification.CATEGORY_EVENT

CATEGORY_MESSAGE

static val CATEGORY_MESSAGE: String

Notification category: incoming direct message (SMS, instant message, etc.).

Value: Notification.CATEGORY_MESSAGE

CATEGORY_NAVIGATION

static val CATEGORY_NAVIGATION: String

Notification category: map turn-by-turn navigation.

Value: Notification.CATEGORY_NAVIGATION

CATEGORY_PROGRESS

static val CATEGORY_PROGRESS: String

Notification category: progress of a long-running background operation.

Value: Notification.CATEGORY_PROGRESS

CATEGORY_PROMO

static val CATEGORY_PROMO: String

Notification category: promotion or advertisement.

Value: Notification.CATEGORY_PROMO

CATEGORY_RECOMMENDATION

static val CATEGORY_RECOMMENDATION: String

Notification category: a specific, timely recommendation for a single thing. For example, a news app might want to recommend a news story it believes the user will want to read next.

Value: Notification.CATEGORY_RECOMMENDATION

CATEGORY_REMINDER

static val CATEGORY_REMINDER: String

Notification category: user-scheduled reminder.

Value: Notification.CATEGORY_REMINDER

CATEGORY_SERVICE

static val CATEGORY_SERVICE: String

Notification category: indication of running background service.

Value: Notification.CATEGORY_SERVICE

CATEGORY_SOCIAL

static val CATEGORY_SOCIAL: String

Notification category: social network or sharing update.

Value: Notification.CATEGORY_SOCIAL

CATEGORY_STATUS

static val CATEGORY_STATUS: String

Notification category: ongoing information about device or contextual status.

Value: Notification.CATEGORY_STATUS

CATEGORY_SYSTEM

static val CATEGORY_SYSTEM: String

Notification category: system or device status update. Reserved for system use.

Value: Notification.CATEGORY_SYSTEM

CATEGORY_TRANSPORT

static val CATEGORY_TRANSPORT: String

Notification category: media transport control for playback.

Value: Notification.CATEGORY_TRANSPORT

COLOR_DEFAULT

static val COLOR_DEFAULT: Int

Value of Notification#color equal to 0 (also known as Color.TRANSPARENT), telling the system not to decorate this notification with any special color but instead use default colors when presenting this notification.

Value: Color.TRANSPARENT

DEFAULT_ALL

static val DEFAULT_ALL: Int

Use all default values (where applicable).

Value: ~0

DEFAULT_LIGHTS

static val DEFAULT_LIGHTS: Int

Use the default notification lights. This will ignore the FLAG_SHOW_LIGHTS bit, and values set with Builder#setLights.

Value: 4

DEFAULT_SOUND

static val DEFAULT_SOUND: Int

Use the default notification sound. This will ignore any sound set using Builder#setSound

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

Value: 1

DEFAULT_VIBRATE

static val DEFAULT_VIBRATE: Int

Use the default notification vibrate. This will ignore any vibrate set using Builder#setVibrate. Using phone vibration requires the VIBRATE permission.

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

Value: 2

EXTRA_AUDIO_CONTENTS_URI

static val EXTRA_AUDIO_CONTENTS_URI: String

Keys into the getExtras Bundle: the audio contents of this notification. This is for use when rendering the notification on an audio-focused interface; the audio contents are a complete sound sample that contains the contents/body of the notification. This may be used in substitute of a Text-to-Speech reading of the notification. For example if the notification represents a voice message this should point to the audio of that message. The data stored under this key should be a String representation of a Uri that contains the audio contents in one of the following formats: WAV, PCM 16-bit, AMR-WB. This extra is unnecessary if you are using MessagingStyle since each Message has a field for holding data URI. That field can be used for audio. See Message#setData. Example usage:

<code>NotificationCompat.Builder myBuilder = (build your Notification as normal);
      myBuilder.getExtras().putString(EXTRA_AUDIO_CONTENTS_URI, myAudioUri.toString());
      </code>

Value: "android.audioContents"

EXTRA_BACKGROUND_IMAGE_URI

static val EXTRA_BACKGROUND_IMAGE_URI: String

Notification extras key: A content URI pointing to an image that can be displayed in the background when the notification is selected. The URI must point to an image stream suitable for passing into BitmapFactory.decodeStream; all other content types will be ignored. The content provider URI used for this purpose must require no permissions to read the image data.

Value: "android.backgroundImageUri"

EXTRA_BIG_TEXT

static val EXTRA_BIG_TEXT: String

Notification extras key: this is the longer text shown in the big form of a BigTextStyle notification, as supplied to BigTextStyle#bigText(CharSequence).

Value: "android.bigText"

EXTRA_CHRONOMETER_COUNT_DOWN

static val EXTRA_CHRONOMETER_COUNT_DOWN: String

Notification extras key: whether the chronometer set on the notification should count down instead of counting up. Is only relevant if key EXTRA_SHOW_CHRONOMETER is present. This extra is a boolean. The default is (@code false).

Value: "android.chronometerCountDown"

EXTRA_COMPACT_ACTIONS

static val EXTRA_COMPACT_ACTIONS: String

Notification extras key: the indices of actions to be shown in the compact view, as supplied to (e.g.) Notification.MediaStyle#setShowActionsInCompactView(int...).

Value: "android.compactActions"

EXTRA_CONVERSATION_TITLE

static val EXTRA_CONVERSATION_TITLE: String

Notification key: a String to be displayed as the title to a conversation represented by a MessagingStyle.

Value: "android.conversationTitle"

EXTRA_HIDDEN_CONVERSATION_TITLE

static val EXTRA_HIDDEN_CONVERSATION_TITLE: String

Key for compat's MessagingStyle#getConversationTitle(). This allows backwards support for conversation titles as SDK < P uses the title to denote group status. This hidden title doesn't appear in the notification shade.

Value: "android.hiddenConversationTitle"

EXTRA_INFO_TEXT

static val EXTRA_INFO_TEXT: String

Notification extras key: this is a small piece of additional text as supplied to Builder#setContentInfo(CharSequence).

Value: "android.infoText"

EXTRA_IS_GROUP_CONVERSATION

static val EXTRA_IS_GROUP_CONVERSATION: String

Notification key: whether the NotificationCompat.MessagingStyle notification represents a group conversation.

Value: "android.isGroupConversation"

EXTRA_LARGE_ICON

static val EXTRA_LARGE_ICON: String

Notification extras key: this is a bitmap to be used instead of the small icon when showing the notification payload, as supplied to Builder#setLargeIcon(android.graphics.Bitmap).

Value: "android.largeIcon"

EXTRA_LARGE_ICON_BIG

static val EXTRA_LARGE_ICON_BIG: String

Notification extras key: this is a bitmap to be used instead of the one from Builder#setLargeIcon(android.graphics.Bitmap) when the notification is shown in its expanded form, as supplied to BigPictureStyle#bigLargeIcon(android.graphics.Bitmap).

Value: EXTRA_LARGE_ICON + ".big"

EXTRA_MEDIA_SESSION

static val EXTRA_MEDIA_SESSION: String

Notification key: A android.media.session.MediaSession.Token associated with a android.app.Notification.MediaStyle notification.

Value: "android.mediaSession"

EXTRA_MESSAGES

static val EXTRA_MESSAGES: String

Notification key: an array of Bundle objects representing MessagingStyle.Message objects for a MessagingStyle notification.

Value: "android.messages"

EXTRA_MESSAGING_STYLE_USER

static val EXTRA_MESSAGING_STYLE_USER: String

Notification key: the person to display for all messages sent by the user, including direct replies to MessagingStyle notifications.

Value: "android.messagingStyleUser"

EXTRA_PEOPLE

static val EXTRA_PEOPLE: String

Notification extras key: A String array containing the people that this notification relates to, each of which was supplied to Builder#addPerson(String).

Value: "android.people"

EXTRA_PICTURE

static val EXTRA_PICTURE: String

Notification extras key: this is a bitmap to be shown in BigPictureStyle expanded notifications, supplied to BigPictureStyle#bigPicture(android.graphics.Bitmap).

Value: "android.picture"

EXTRA_PROGRESS

static val EXTRA_PROGRESS: String

Notification extras key: this is the progress value supplied to Builder#setProgress(int, int, boolean).

Value: "android.progress"

EXTRA_PROGRESS_INDETERMINATE

static val EXTRA_PROGRESS_INDETERMINATE: String

Notification extras key: whether the progress bar is indeterminate, supplied to Builder#setProgress(int, int, boolean).

Value: "android.progressIndeterminate"

EXTRA_PROGRESS_MAX

static val EXTRA_PROGRESS_MAX: String

Notification extras key: this is the maximum value supplied to Builder#setProgress(int, int, boolean).

Value: "android.progressMax"

EXTRA_REMOTE_INPUT_HISTORY

static val EXTRA_REMOTE_INPUT_HISTORY: String

Notification extras key: this is the remote input history, as supplied to Builder#setRemoteInputHistory(CharSequence[]). Apps can fill this through Builder#setRemoteInputHistory(CharSequence[]) with the most recent inputs that have been sent through a RemoteInput of this Notification and are expected to clear it once the it is no longer relevant (e.g. for chat notifications once the other party has responded). The extra with this key is of type CharSequence[] and contains the most recent entry at the 0 index, the second most recent at the 1 index, etc.

Value: "android.remoteInputHistory"

EXTRA_SELF_DISPLAY_NAME

static val EXTRA_SELF_DISPLAY_NAME: String

Notification key: the username to be displayed for all messages sent by the user including direct replies MessagingStyle notification.

Value: "android.selfDisplayName"

EXTRA_SHOW_CHRONOMETER

static val EXTRA_SHOW_CHRONOMETER: String

Notification extras key: whether the when field set using Builder#setWhen should be shown as a count-up timer (specifically a android.widget.Chronometer) instead of a timestamp, as supplied to Builder#setUsesChronometer(boolean).

Value: "android.showChronometer"

EXTRA_SHOW_WHEN

static val EXTRA_SHOW_WHEN: String

Notification extras key: whether the when field set using Builder#setWhen should be shown, as supplied to Builder#setShowWhen(boolean).

Value: "android.showWhen"

EXTRA_SMALL_ICON

static val EXTRA_SMALL_ICON: String

Notification extras key: this is the resource ID of the notification's main small icon, as supplied to Builder#setSmallIcon(int).

Value: "android.icon"

EXTRA_SUB_TEXT

static val EXTRA_SUB_TEXT: String

Notification extras key: this is a third line of text, as supplied to Builder#setSubText(CharSequence).

Value: "android.subText"

EXTRA_SUMMARY_TEXT

static val EXTRA_SUMMARY_TEXT: String

Notification extras key: this is a line of summary information intended to be shown alongside expanded notifications, as supplied to (e.g.) BigTextStyle#setSummaryText(CharSequence).

Value: "android.summaryText"

EXTRA_TEMPLATE

static val EXTRA_TEMPLATE: String

Notification extras key: A string representing the name of the specific android.app.Notification.Style used to create this notification.

Value: "android.template"

EXTRA_TEXT

static val EXTRA_TEXT: String

Notification extras key: this is the main text payload, as supplied to Builder#setContentText(CharSequence).

Value: "android.text"

EXTRA_TEXT_LINES

static val EXTRA_TEXT_LINES: String

Notification extras key: An array of CharSequences to show in InboxStyle expanded notifications, each of which was supplied to InboxStyle#addLine(CharSequence).

Value: "android.textLines"

EXTRA_TITLE

static val EXTRA_TITLE: String

Notification extras key: this is the title of the notification, as supplied to Builder#setContentTitle(CharSequence).

Value: "android.title"

EXTRA_TITLE_BIG

static val EXTRA_TITLE_BIG: String

Notification extras key: this is the title of the notification when shown in expanded form, e.g. as supplied to BigTextStyle#setBigContentTitle(CharSequence).

Value: EXTRA_TITLE + ".big"

FLAG_AUTO_CANCEL

static val FLAG_AUTO_CANCEL: Int

Bit set in the Notification flags field if the notification should be canceled when it is clicked by the user.

Value: 0x00000010

FLAG_BUBBLE

static val FLAG_BUBBLE: Int

Bit set in the Notification flags field if this notification is showing as a bubble. Applications cannot set this flag directly; they should instead call NotificationCompat.Builder#setBubbleMetadata(BubbleMetadata) to request that a notification be displayed as a bubble, and then check this flag to see whether that request was honored by the system.

Value: 0x00001000

FLAG_FOREGROUND_SERVICE

static val FLAG_FOREGROUND_SERVICE: Int

Bit set in the Notification flags field if this notification represents a currently running service. This will normally be set for you by android.app.Service#startForeground.

Value: 0x00000040

FLAG_GROUP_SUMMARY

static val FLAG_GROUP_SUMMARY: Int

Bit set in the Notification flags field if this notification is 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 Builder#setGroup.

Value: 0x00000200

FLAG_HIGH_PRIORITY

static val FLAG_HIGH_PRIORITY: Int

Deprecated: Use NotificationCompat.Builder#setPriority(int) with a positive value.

Obsolete flag indicating high-priority notifications; use the priority field instead.

Value: 0x00000080

FLAG_INSISTENT

static val FLAG_INSISTENT: Int

Bit set in the Notification flags field if the audio will be repeated until the notification is cancelled or the notification window is opened.

Value: 0x00000004

FLAG_LOCAL_ONLY

static val FLAG_LOCAL_ONLY: Int

Bit set in the Notification flags field if this notification is relevant to the current device only and it is not recommended that it bridge to other devices.

Value: 0x00000100

FLAG_NO_CLEAR

static val FLAG_NO_CLEAR: Int

Bit set in the Notification flags field if the notification should not be canceled when the user clicks the Clear all button.

Value: 0x00000020

FLAG_ONGOING_EVENT

static val FLAG_ONGOING_EVENT: Int

Bit set in the Notification flags field if this notification is in reference to something that is ongoing, like a phone call. It should not be set if this notification is in reference to something that happened at a particular point in time, like a missed phone call.

Value: 0x00000002

FLAG_ONLY_ALERT_ONCE

static val FLAG_ONLY_ALERT_ONCE: Int

Bit set in the Notification flags field if the notification's sound, vibrate and ticker should only be played if the notification is not already showing.

Value: 0x00000008

FLAG_SHOW_LIGHTS

static val FLAG_SHOW_LIGHTS: Int

Bit set in the Notification flags field when LEDs should be turned on for this notification.

Value: 0x00000001

GROUP_ALERT_ALL

static val GROUP_ALERT_ALL: Int

Constant for Builder#setGroupAlertBehavior(int), meaning that all notifications in a group with sound or vibration ought to make sound or vibrate (respectively), so this notification will not be muted when it is in a group.

Value: Notification.GROUP_ALERT_ALL

GROUP_ALERT_CHILDREN

static val GROUP_ALERT_CHILDREN: Int

Constant for Builder#setGroupAlertBehavior(int), meaning that the summary notification in a group should be silenced (no sound or vibration) even if they would otherwise make sound or vibrate. Use this constant to mute this notification if this notification is a group summary.

For example, you might want to use this constant if only the children notifications in your group have content and the summary is only used to visually group notifications rather than to alert the user that new information is available.

Value: Notification.GROUP_ALERT_CHILDREN

GROUP_ALERT_SUMMARY

static val GROUP_ALERT_SUMMARY: Int

Constant for Builder#setGroupAlertBehavior(int), meaning that all children notification in a group should be silenced (no sound or vibration) even if they would otherwise make sound or vibrate. Use this constant to mute this notification if this notification is a group child. This must be applied to all children notifications you want to mute.

For example, you might want to use this constant if you post a number of children notifications at once (say, after a periodic sync), and only need to notify the user audibly once.

Value: Notification.GROUP_ALERT_SUMMARY

PRIORITY_DEFAULT

static val PRIORITY_DEFAULT: Int

Default notification priority for NotificationCompat.Builder#setPriority(int). If your application does not prioritize its own notifications, use this value for all notifications.

Value: 0

PRIORITY_HIGH

static val PRIORITY_HIGH: Int

Higher notification priority for NotificationCompat.Builder#setPriority(int), for more important notifications or alerts. The UI may choose to show these items larger, or at a different position in notification lists, compared with your app's PRIORITY_DEFAULT items.

Value: 1

PRIORITY_LOW

static val PRIORITY_LOW: Int

Lower notification priority for NotificationCompat.Builder#setPriority(int), for items that are less important. The UI may choose to show these items smaller, or at a different position in the list, compared with your app's PRIORITY_DEFAULT items.

Value: -1

PRIORITY_MAX

static val PRIORITY_MAX: Int

Highest notification priority for NotificationCompat.Builder#setPriority(int), for your application's most important items that require the user's prompt attention or input.

Value: 2

PRIORITY_MIN

static val PRIORITY_MIN: Int

Lowest notification priority for NotificationCompat.Builder#setPriority(int); these items might not be shown to the user except under special circumstances, such as detailed notification logs.

Value: -2

STREAM_DEFAULT

static val STREAM_DEFAULT: Int

Use this constant as the value for audioStreamType to request that the default stream type for notifications be used. Currently the default stream type is AudioManager#STREAM_NOTIFICATION.

Value: -1

VISIBILITY_PRIVATE

static val VISIBILITY_PRIVATE: Int

Notification visibility: Show this notification on all lockscreens, but conceal sensitive or private information on secure lockscreens. {@see android.app.Notification#visibility}

Value: Notification.VISIBILITY_PRIVATE

VISIBILITY_PUBLIC

static val VISIBILITY_PUBLIC: Int

Notification visibility: Show this notification in its entirety on all lockscreens. {@see android.app.Notification#visibility}

Value: Notification.VISIBILITY_PUBLIC

VISIBILITY_SECRET

static val VISIBILITY_SECRET: Int

Notification visibility: Do not reveal any part of this notification on a secure lockscreen. {@see android.app.Notification#visibility}

Value: Notification.VISIBILITY_SECRET

Public constructors

<init>

NotificationCompat()

Deprecated: This type should not be instantiated as it contains only static methods.

Public methods

getAction

open static fun getAction(notification: Notification!, actionIndex: Int): NotificationCompat.Action!

Get an action on this notification in a backwards compatible manner. Actions were supported from JellyBean (Api level 16) forwards.

Parameters
notification Notification!: The notification to inspect.
actionIndex Notification!: The index of the action to retrieve.

getActionCount

open static fun getActionCount(notification: Notification!): Int

Get the number of actions in this notification in a backwards compatible manner. Actions were supported from JellyBean (Api level 16) forwards.

getAllowSystemGeneratedContextualActions

open static fun getAllowSystemGeneratedContextualActions(notification: Notification!): Boolean

Returns whether the platform is allowed (by the app developer) to generate contextual actions for this notification.

getBadgeIconType

open static fun getBadgeIconType(notification: Notification!): Int

Returns what icon should be shown for this notification if it is being displayed in a Launcher that supports badging. Will be one of BADGE_ICON_NONE, BADGE_ICON_SMALL, or BADGE_ICON_LARGE.

getBubbleMetadata

@Nullable open static fun getBubbleMetadata(@NonNull notification: Notification): NotificationCompat.BubbleMetadata?

Get the BubbleMetadata for a notification that will be used to display app content in a floating window over the existing foreground activity.

Parameters
notification Notification: the notification to inspect
Return
NotificationCompat.BubbleMetadata?: the BubbleMetadata if available and set, otherwise null

getCategory

open static fun getCategory(notification: Notification!): String!

Get the category of this notification in a backwards compatible manner.

Parameters
notification Notification!: The notification to inspect.

getChannelId

open static fun getChannelId(notification: Notification!): String!
Return
String!: the ID of the channel this notification posts to.

getContentTitle

open static fun getContentTitle(notification: Notification!): CharSequence!

Returns the content title of a Notification.

getExtras

@Nullable open static fun getExtras(notification: Notification!): Bundle?

Gets the Notification#extras field from a notification in a backwards compatible manner. Extras field was supported from JellyBean (Api level 16) forwards. This function will return null on older api levels.

getGroup

open static fun getGroup(notification: Notification!): String!

Get the key used to group this notification into a cluster or stack with other notifications on devices which support such rendering.

getGroupAlertBehavior

open static fun getGroupAlertBehavior(notification: Notification!): Int

Returns which type of notifications in a group are responsible for audibly alerting the user. See GROUP_ALERT_ALL, GROUP_ALERT_CHILDREN, GROUP_ALERT_SUMMARY.

getInvisibleActions

open static fun getInvisibleActions(notification: Notification!): MutableList<NotificationCompat.Action!>!

Returns the invisible actions contained within the given notification.

getLocalOnly

open static fun getLocalOnly(notification: Notification!): Boolean

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

Some notifications can be bridged to other devices for remote display. If this hint is set, it is recommend that this notification not be bridged.

getShortcutId

open static fun getShortcutId(notification: Notification!): String!

Returns the id that this notification supersedes, if any.

getSortKey

open static fun getSortKey(notification: Notification!): String!

Get 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 Builder#setGroup.

getTimeoutAfter

open static fun getTimeoutAfter(notification: Notification!): Long

Returns the time at which this notification should be canceled by the system, if it's not canceled already.

isGroupSummary

open static fun isGroupSummary(notification: Notification!): Boolean

Get whether 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 Builder#setGroup.

Return
Boolean: Whether this notification is a group summary.