NotificationCompat

Added in 1.1.0

class NotificationCompat


Helper for accessing features in android.app.Notification.

Summary

Nested types

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

Builder class for Action objects.

Extender interface for use with extend.

@IntDef(value = )
@Retention(value = RetentionPolicy.SOURCE)
annotation NotificationCompat.Action.SemanticAction

Provides meaning to an Action that hints at what the associated PendingIntent will do.

Wearable extender for notification actions.

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

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

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

Builder to construct a BubbleMetadata object.

Builder class for NotificationCompat objects.

Helper class for generating large-format notifications that include a caller and required actions, and indicate an incoming call.

Helper class to add Android Auto extensions to notifications.

This class is deprecated.

UnreadConversation is no longer supported.

Builder class for CarExtender.UnreadConversation objects.

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

Extender interface for use with extend.

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

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

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

Helper class to add Android TV extensions to notifications.

Helper class to add wearable extensions to notifications.

Constants

const Int

If this notification is being shown as a badge, use the icon provided to setLargeIcon to represent this notification.

const Int

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

const Int

If this notification is being shown as a badge, use the icon provided to setSmallIcon to represent this notification.

const String!
CATEGORY_ALARM = "alarm"

Notification category: alarm or timer.

const String!
CATEGORY_CALL = "call"

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

const String!
CATEGORY_EMAIL = "email"

Notification category: asynchronous bulk message (email).

const String!

Notification category: error in background operation or authentication status.

const String!
CATEGORY_EVENT = "event"

Notification category: calendar event.

const String!
CATEGORY_LOCATION_SHARING = "location_sharing"

Notification category: temporarily sharing location.

const String!

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

const String!
CATEGORY_MISSED_CALL = "missed_call"

Notification category: missed call.

const String!
CATEGORY_NAVIGATION = "navigation"

Notification category: map turn-by-turn navigation.

const String!
CATEGORY_PROGRESS = "progress"

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

const String!
CATEGORY_PROMO = "promo"

Notification category: promotion or advertisement.

const String!
CATEGORY_RECOMMENDATION = "recommendation"

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

const String!
CATEGORY_REMINDER = "reminder"

Notification category: user-scheduled reminder.

const String!
CATEGORY_SERVICE = "service"

Notification category: indication of running background service.

const String!
CATEGORY_SOCIAL = "social"

Notification category: social network or sharing update.

const String!
CATEGORY_STATUS = "status"

Notification category: ongoing information about device or contextual status.

const String!
CATEGORY_STOPWATCH = "stopwatch"

Notification category: running stopwatch.

const String!

Notification category: system or device status update.

const String!
CATEGORY_TRANSPORT = "transport"

Notification category: media transport control for playback.

const String!
CATEGORY_VOICEMAIL = "voicemail"

Notification category: voicemail.

const String!
CATEGORY_WORKOUT = "workout"

Notification category: tracking a user's workout.

const @ColorInt Int

Value of 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.

const Int

Use all default values (where applicable).

const Int

Use the default notification lights.

const Int

Use the default notification sound.

const Int

Use the default notification vibrate.

const String!
EXTRA_ANSWER_COLOR = "android.answerColor"

extras key: the color used as a hint for the Answer action button of a android.app.Notification.CallStyle notification.

const String!
EXTRA_ANSWER_INTENT = "android.answerIntent"

extras key: the intent to be sent when the users answers a android.app.Notification.CallStyle notification.

const String!
EXTRA_AUDIO_CONTENTS_URI = "android.audioContents"

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

const String!
EXTRA_BACKGROUND_IMAGE_URI = "android.backgroundImageUri"

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

const String!
EXTRA_BIG_TEXT = "android.bigText"

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

const String!
EXTRA_CALL_IS_VIDEO = "android.callIsVideo"

extras key: whether the android.app.Notification.CallStyle notification is for a call that will activate video when answered.

const String!
EXTRA_CALL_PERSON = "android.callPerson"

extras key: the person to be displayed as calling for the android.app.Notification.CallStyle notification.

const String!
EXTRA_CALL_PERSON_COMPAT = "android.callPersonCompat"

extras key: the person to be displayed as calling for the android.app.Notification.CallStyle notification, for Android versions before the Person class was introduced.

const String!
EXTRA_CALL_TYPE = "android.callType"

extras key: the type of call represented by the android.app.Notification.CallStyle notification.

const String!
EXTRA_CHANNEL_GROUP_ID = "android.intent.extra.CHANNEL_GROUP_ID"

Optional extra for INTENT_CATEGORY_NOTIFICATION_PREFERENCES.

const String!
EXTRA_CHANNEL_ID = "android.intent.extra.CHANNEL_ID"

Optional extra for INTENT_CATEGORY_NOTIFICATION_PREFERENCES.

const String!
EXTRA_CHRONOMETER_COUNT_DOWN = "android.chronometerCountDown"

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

const String!
EXTRA_COLORIZED = "android.colorized"

extras key: whether the notification should be colorized as supplied to setColorized.

const String!
EXTRA_COMPACT_ACTIONS = "android.compactActions"

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

const String!
EXTRA_COMPAT_TEMPLATE = "androidx.core.app.extra.COMPAT_TEMPLATE"

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

const String!
EXTRA_CONVERSATION_TITLE = "android.conversationTitle"

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

const String!
EXTRA_DECLINE_COLOR = "android.declineColor"

extras key: the color used as a hint for the Decline or Hang Up action button of a android.app.Notification.CallStyle notification.

const String!
EXTRA_DECLINE_INTENT = "android.declineIntent"

extras key: the intent to be sent when the users declines a android.app.Notification.CallStyle notification.

const String!
EXTRA_HANG_UP_INTENT = "android.hangUpIntent"

extras key: the intent to be sent when the users hangs up a android.app.Notification.CallStyle notification.

const String!
EXTRA_HIDDEN_CONVERSATION_TITLE = "android.hiddenConversationTitle"

Key for compat's getConversationTitle.

const String!
EXTRA_HISTORIC_MESSAGES = "android.messages.historic"

extras key: an array of historicMessagingStyle.Message bundles provided by a MessagingStyle notification.

const String!
EXTRA_INFO_TEXT = "android.infoText"

extras key: this is a small piece of additional text as supplied to setContentInfo.

const String!
EXTRA_IS_GROUP_CONVERSATION = "android.isGroupConversation"

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

const String!
EXTRA_LARGE_ICON = "android.largeIcon"

extras key: this is a bitmap to be used instead of the small icon when showing the notification payload, as supplied to setLargeIcon.

const String!
EXTRA_LARGE_ICON_BIG = "android.largeIcon.big"

extras key: this is a bitmap to be used instead of the one from setLargeIcon when the notification is shown in its expanded form, as supplied to bigLargeIcon.

const String!
EXTRA_MEDIA_SESSION = "android.mediaSession"

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

const String!
EXTRA_MESSAGES = "android.messages"

extras key: an array of MessagingStyle.Message bundles provided by a android.app.Notification.MessagingStyle notification.

const String!
EXTRA_MESSAGING_STYLE_USER = "android.messagingStyleUser"

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

const String!
EXTRA_NOTIFICATION_ID = "android.intent.extra.NOTIFICATION_ID"

Optional extra for INTENT_CATEGORY_NOTIFICATION_PREFERENCES.

const String!
EXTRA_NOTIFICATION_TAG = "android.intent.extra.NOTIFICATION_TAG"

Optional extra for INTENT_CATEGORY_NOTIFICATION_PREFERENCES.

const String!
EXTRA_PEOPLE = "android.people"

This property is deprecated.

the actual objects are now in EXTRA_PEOPLE_LIST

const String!
EXTRA_PEOPLE_LIST = "android.people.list"

extras key: : An arrayList of Person objects containing the people that this notification relates to, each of which was supplied to addPerson.

const String!
EXTRA_PICTURE = "android.picture"

extras key: this is a bitmap to be shown in BigPictureStyle expanded notifications, supplied to bigPicture.

const String!
EXTRA_PICTURE_CONTENT_DESCRIPTION = "android.pictureContentDescription"

extras key: this is a content description of the big picture supplied from bigPicture, supplied to setContentDescription.

const String!
EXTRA_PICTURE_ICON = "android.pictureIcon"

extras key: this is an Icon of an image to be shown in Notification.BigPictureStyle expanded notifications, supplied to bigPicture.

const String!
EXTRA_PROGRESS = "android.progress"

extras key: this is the progress value supplied to setProgress.

const String!
EXTRA_PROGRESS_INDETERMINATE = "android.progressIndeterminate"

extras key: whether the progress bar is indeterminate, supplied to setProgress.

const String!
EXTRA_PROGRESS_MAX = "android.progressMax"

extras key: this is the maximum value supplied to setProgress.

const String!
EXTRA_REMOTE_INPUT_HISTORY = "android.remoteInputHistory"

extras key: this is the remote input history, as supplied to setRemoteInputHistory.

const String!
EXTRA_SELF_DISPLAY_NAME = "android.selfDisplayName"

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

const String!
EXTRA_SHOW_BIG_PICTURE_WHEN_COLLAPSED = "android.showBigPictureWhenCollapsed"

extras key: this is a boolean to indicate that the big picture is to be shown in the collapsed state of a BigPictureStyle notification.

const String!
EXTRA_SHOW_CHRONOMETER = "android.showChronometer"

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

const String!
EXTRA_SHOW_WHEN = "android.showWhen"

extras key: whether the when field set using setWhen should be shown, as supplied to setShowWhen.

const String!
EXTRA_SMALL_ICON = "android.icon"

extras key: this is the resource ID of the notification's main small icon, as supplied to setSmallIcon.

const String!
EXTRA_SUB_TEXT = "android.subText"

extras key: this is a third line of text, as supplied to setSubText.

const String!
EXTRA_SUMMARY_TEXT = "android.summaryText"

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

const String!
EXTRA_TEMPLATE = "android.template"

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

const String!
EXTRA_TEXT = "android.text"

extras key: this is the main text payload, as supplied to setContentText.

const String!
EXTRA_TEXT_LINES = "android.textLines"

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

const String!
EXTRA_TITLE = "android.title"

extras key: this is the title of the notification, as supplied to setContentTitle.

const String!
EXTRA_TITLE_BIG = "android.title.big"

extras key: this is the title of the notification when shown in expanded form, e.g. as supplied to setBigContentTitle.

const String!
EXTRA_VERIFICATION_ICON = "android.verificationIcon"

extras key: the icon to be displayed as a verification status of the caller on a android.app.Notification.CallStyle notification.

const String!
EXTRA_VERIFICATION_ICON_COMPAT = "android.verificationIconCompat"

extras key: the icon to be displayed as a verification status of the caller on a android.app.Notification.CallStyle notification, for Android versions before the Icon class was introduced.

const String!
EXTRA_VERIFICATION_TEXT = "android.verificationText"

extras key: the text to be displayed as a verification status of the caller on a android.app.Notification.CallStyle notification.

const Int

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

const Int

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

const Int

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

const Int

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

const Int

This property is deprecated.

Use setPriority with a positive value.

const 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.

const 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.

const Int

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

const Int

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

const 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.

const Int

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

const Int

Constant for setForegroundServiceBehavior.

const Int

Constant for setForegroundServiceBehavior.

const Int

Constant for setForegroundServiceBehavior.

const Int

Constant for setGroupAlertBehavior, 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.

const Int

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

const Int

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

const String!
GROUP_KEY_SILENT = "silent"

Constant for the group key that's added to notifications that are not already grouped when setNotificationSilent is used when SDK_INT is >= O.

const String!
INTENT_CATEGORY_NOTIFICATION_PREFERENCES = "android.intent.category.NOTIFICATION_PREFERENCES"

An activity that provides a user interface for adjusting notification preferences for its containing application.

const Int

Default notification priority for setPriority.

const Int

Higher notification priority for setPriority, for more important notifications or alerts.

const Int

Lower notification priority for setPriority, for items that are less important.

const Int

Highest notification priority for setPriority, for your application's most important items that require the user's prompt attention or input.

const Int

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

const Int

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

const Int

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

const Int

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

const Int

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

Public constructors

This function is deprecated.

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

Public functions

java-static NotificationCompat.Action?
getAction(notification: Notification, actionIndex: Int)

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

java-static Int

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

java-static Boolean

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

java-static Boolean
getAutoCancel(notification: Notification)

Get the value provided to setAutoCancel

java-static Int

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

java-static 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.

java-static String?
getCategory(notification: Notification)

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

java-static String?
getChannelId(notification: Notification)
java-static Int
getColor(notification: Notification)

Get the value provided to setColor

java-static CharSequence?

Returns the content info provided to setContentInfo.

java-static CharSequence?

Returns the content text provided to setContentText.

java-static CharSequence?

Returns the content title provided to setContentTitle.

java-static Bundle?
@ReplaceWith(expression = "notification.extras")
getExtras(notification: Notification)

This function is deprecated.

Call extras directly.

java-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.

java-static Int

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

java-static (Mutable)List<NotificationCompat.Action!>
@RequiresApi(value = 21)
getInvisibleActions(notification: Notification)

Returns the invisible actions contained within the given notification.

java-static Boolean
getLocalOnly(notification: Notification)

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

java-static LocusIdCompat?
getLocusId(notification: Notification)

Gets the LocusIdCompat associated with this notification.

java-static Boolean
getOngoing(notification: Notification)

Get the value provided to setOngoing

java-static Boolean

Get the value provided to setOnlyAlertOnce

java-static (Mutable)List<Person!>
getPeople(notification: Notification)

Returns the people in the notification.

java-static Notification?

Get the value provided to setVisibility

java-static CharSequence?

Returns the settings text provided to setSettingsText.

java-static String?
getShortcutId(notification: Notification)

Returns the id that this notification supersedes, if any.

java-static Boolean
getShowWhen(notification: Notification)

Get the value provided to setShowWhen

java-static String?
getSortKey(notification: Notification)

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

java-static CharSequence?
getSubText(notification: Notification)

Returns the sub text provided to setSubText.

java-static Long

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

java-static Boolean

Get the value provided to setUsesChronometer

java-static Int
getVisibility(notification: Notification)

Get the value provided to setVisibility

java-static Boolean

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

java-static Bitmap?
reduceLargeIconSize(context: Context, icon: Bitmap?)

Reduces the size of a provided icon if it's larger than the maximum allowed for a notification large icon; returns the resized icon.

Constants

BADGE_ICON_LARGE

Added in 1.1.0
const val BADGE_ICON_LARGE = 2: Int

If this notification is being shown as a badge, use the icon provided to setLargeIcon to represent this notification.

BADGE_ICON_NONE

Added in 1.1.0
const val BADGE_ICON_NONE = 0: Int

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

BADGE_ICON_SMALL

Added in 1.1.0
const val BADGE_ICON_SMALL = 1: Int

If this notification is being shown as a badge, use the icon provided to setSmallIcon to represent this notification.

CATEGORY_ALARM

Added in 1.1.0
const val CATEGORY_ALARM = "alarm": String!

Notification category: alarm or timer.

CATEGORY_CALL

Added in 1.1.0
const val CATEGORY_CALL = "call": String!

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

CATEGORY_EMAIL

Added in 1.1.0
const val CATEGORY_EMAIL = "email": String!

Notification category: asynchronous bulk message (email).

CATEGORY_ERROR

Added in 1.1.0
const val CATEGORY_ERROR = "err": String!

Notification category: error in background operation or authentication status.

CATEGORY_EVENT

Added in 1.1.0
const val CATEGORY_EVENT = "event": String!

Notification category: calendar event.

CATEGORY_LOCATION_SHARING

Added in 1.5.0
const val CATEGORY_LOCATION_SHARING = "location_sharing": String!

Notification category: temporarily sharing location.

CATEGORY_MESSAGE

Added in 1.1.0
const val CATEGORY_MESSAGE = "msg": String!

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

CATEGORY_MISSED_CALL

Added in 1.5.0
const val CATEGORY_MISSED_CALL = "missed_call": String!

Notification category: missed call.

CATEGORY_NAVIGATION

Added in 1.1.0
const val CATEGORY_NAVIGATION = "navigation": String!

Notification category: map turn-by-turn navigation.

CATEGORY_PROGRESS

Added in 1.1.0
const val CATEGORY_PROGRESS = "progress": String!

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

CATEGORY_PROMO

Added in 1.1.0
const val CATEGORY_PROMO = "promo": String!

Notification category: promotion or advertisement.

CATEGORY_RECOMMENDATION

Added in 1.1.0
const val CATEGORY_RECOMMENDATION = "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.

CATEGORY_REMINDER

Added in 1.1.0
const val CATEGORY_REMINDER = "reminder": String!

Notification category: user-scheduled reminder.

CATEGORY_SERVICE

Added in 1.1.0
const val CATEGORY_SERVICE = "service": String!

Notification category: indication of running background service.

CATEGORY_SOCIAL

Added in 1.1.0
const val CATEGORY_SOCIAL = "social": String!

Notification category: social network or sharing update.

CATEGORY_STATUS

Added in 1.1.0
const val CATEGORY_STATUS = "status": String!

Notification category: ongoing information about device or contextual status.

CATEGORY_STOPWATCH

Added in 1.5.0
const val CATEGORY_STOPWATCH = "stopwatch": String!

Notification category: running stopwatch.

CATEGORY_SYSTEM

Added in 1.1.0
const val CATEGORY_SYSTEM = "sys": String!

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

CATEGORY_TRANSPORT

Added in 1.1.0
const val CATEGORY_TRANSPORT = "transport": String!

Notification category: media transport control for playback.

CATEGORY_VOICEMAIL

Added in 1.15.0
const val CATEGORY_VOICEMAIL = "voicemail": String!

Notification category: voicemail.

CATEGORY_WORKOUT

Added in 1.5.0
const val CATEGORY_WORKOUT = "workout": String!

Notification category: tracking a user's workout.

COLOR_DEFAULT

Added in 1.1.0
const val COLOR_DEFAULT = 0: @ColorInt Int

Value of 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.

DEFAULT_ALL

Added in 1.1.0
const val DEFAULT_ALL = -1: Int

Use all default values (where applicable).

DEFAULT_LIGHTS

Added in 1.1.0
const val DEFAULT_LIGHTS = 4: Int

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

See also
setDefaults

DEFAULT_SOUND

Added in 1.1.0
const val DEFAULT_SOUND = 1: Int

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

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

See also
setDefaults

DEFAULT_VIBRATE

Added in 1.1.0
const val DEFAULT_VIBRATE = 2: Int

Use the default notification vibrate. This will ignore any vibrate set using 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.

See also
setDefaults

EXTRA_ANSWER_COLOR

Added in 1.10.0
const val EXTRA_ANSWER_COLOR = "android.answerColor": String!

extras key: the color used as a hint for the Answer action button of a android.app.Notification.CallStyle notification. This extra is a ColorInt.

EXTRA_ANSWER_INTENT

Added in 1.10.0
const val EXTRA_ANSWER_INTENT = "android.answerIntent": String!

extras key: the intent to be sent when the users answers a android.app.Notification.CallStyle notification. This extra is a PendingIntent.

EXTRA_AUDIO_CONTENTS_URI

Added in 1.1.0
const val EXTRA_AUDIO_CONTENTS_URI = "android.audioContents": 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:

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

EXTRA_BACKGROUND_IMAGE_URI

Added in 1.1.0
const val EXTRA_BACKGROUND_IMAGE_URI = "android.backgroundImageUri": String!

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.

EXTRA_BIG_TEXT

Added in 1.1.0
const val EXTRA_BIG_TEXT = "android.bigText": String!

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

EXTRA_CALL_IS_VIDEO

Added in 1.10.0
const val EXTRA_CALL_IS_VIDEO = "android.callIsVideo": String!

extras key: whether the android.app.Notification.CallStyle notification is for a call that will activate video when answered. This extra is a boolean.

EXTRA_CALL_PERSON

Added in 1.10.0
const val EXTRA_CALL_PERSON = "android.callPerson": String!

extras key: the person to be displayed as calling for the android.app.Notification.CallStyle notification. This extra is a Person.

EXTRA_CALL_PERSON_COMPAT

Added in 1.10.0
const val EXTRA_CALL_PERSON_COMPAT = "android.callPersonCompat": String!

extras key: the person to be displayed as calling for the android.app.Notification.CallStyle notification, for Android versions before the Person class was introduced. This extra is a Bundle representing a Person.

EXTRA_CALL_TYPE

Added in 1.10.0
const val EXTRA_CALL_TYPE = "android.callType": String!

extras key: the type of call represented by the android.app.Notification.CallStyle notification. This extra is an int.

EXTRA_CHANNEL_GROUP_ID

Added in 1.5.0
const val EXTRA_CHANNEL_GROUP_ID = "android.intent.extra.CHANNEL_GROUP_ID": String!

Optional extra for INTENT_CATEGORY_NOTIFICATION_PREFERENCES. If provided, will contain a group id that can be used to narrow down what settings should be shown in the target app.

EXTRA_CHANNEL_ID

Added in 1.5.0
const val EXTRA_CHANNEL_ID = "android.intent.extra.CHANNEL_ID": String!

Optional extra for INTENT_CATEGORY_NOTIFICATION_PREFERENCES. If provided, will contain a channel id that can be used to narrow down what settings should be shown in the target app.

EXTRA_CHRONOMETER_COUNT_DOWN

Added in 1.2.0
const val EXTRA_CHRONOMETER_COUNT_DOWN = "android.chronometerCountDown": String!

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).

EXTRA_COLORIZED

Added in 1.5.0
const val EXTRA_COLORIZED = "android.colorized": String!

extras key: whether the notification should be colorized as supplied to setColorized.

EXTRA_COMPACT_ACTIONS

Added in 1.1.0
const val EXTRA_COMPACT_ACTIONS = "android.compactActions": String!

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

EXTRA_COMPAT_TEMPLATE

Added in 1.5.0
const val EXTRA_COMPAT_TEMPLATE = "androidx.core.app.extra.COMPAT_TEMPLATE": String!

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

EXTRA_CONVERSATION_TITLE

Added in 1.1.0
const val EXTRA_CONVERSATION_TITLE = "android.conversationTitle": String!

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

EXTRA_DECLINE_COLOR

Added in 1.10.0
const val EXTRA_DECLINE_COLOR = "android.declineColor": String!

extras key: the color used as a hint for the Decline or Hang Up action button of a android.app.Notification.CallStyle notification. This extra is a ColorInt.

EXTRA_DECLINE_INTENT

Added in 1.10.0
const val EXTRA_DECLINE_INTENT = "android.declineIntent": String!

extras key: the intent to be sent when the users declines a android.app.Notification.CallStyle notification. This extra is a PendingIntent.

EXTRA_HANG_UP_INTENT

Added in 1.10.0
const val EXTRA_HANG_UP_INTENT = "android.hangUpIntent": String!

extras key: the intent to be sent when the users hangs up a android.app.Notification.CallStyle notification. This extra is a PendingIntent.

EXTRA_HIDDEN_CONVERSATION_TITLE

Added in 1.1.0
const val EXTRA_HIDDEN_CONVERSATION_TITLE = "android.hiddenConversationTitle": String!

Key for compat's getConversationTitle. This allows backwards support for conversation titles as SDK

EXTRA_HISTORIC_MESSAGES

Added in 1.5.0
const val EXTRA_HISTORIC_MESSAGES = "android.messages.historic": String!

extras key: an array of historicMessagingStyle.Message bundles provided by a MessagingStyle notification. This extra is a parcelable array of Bundle objects.

EXTRA_INFO_TEXT

Added in 1.1.0
const val EXTRA_INFO_TEXT = "android.infoText": String!

extras key: this is a small piece of additional text as supplied to setContentInfo.

EXTRA_IS_GROUP_CONVERSATION

Added in 1.1.0
const val EXTRA_IS_GROUP_CONVERSATION = "android.isGroupConversation": String!

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

EXTRA_LARGE_ICON

Added in 1.1.0
const val EXTRA_LARGE_ICON = "android.largeIcon": String!

extras key: this is a bitmap to be used instead of the small icon when showing the notification payload, as supplied to setLargeIcon.

EXTRA_LARGE_ICON_BIG

Added in 1.1.0
const val EXTRA_LARGE_ICON_BIG = "android.largeIcon.big": String!

extras key: this is a bitmap to be used instead of the one from setLargeIcon when the notification is shown in its expanded form, as supplied to bigLargeIcon.

EXTRA_MEDIA_SESSION

Added in 1.1.0
const val EXTRA_MEDIA_SESSION = "android.mediaSession": String!

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

EXTRA_MESSAGES

Added in 1.1.0
const val EXTRA_MESSAGES = "android.messages": String!

extras key: an array of MessagingStyle.Message bundles provided by a android.app.Notification.MessagingStyle notification. This extra is a parcelable array of Bundle objects.

EXTRA_MESSAGING_STYLE_USER

Added in 1.1.0
const val EXTRA_MESSAGING_STYLE_USER = "android.messagingStyleUser": String!

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

EXTRA_NOTIFICATION_ID

Added in 1.5.0
const val EXTRA_NOTIFICATION_ID = "android.intent.extra.NOTIFICATION_ID": String!

Optional extra for INTENT_CATEGORY_NOTIFICATION_PREFERENCES. If provided, will contain the id provided to notify that can be used to narrow down what settings should be shown in the target app.

EXTRA_NOTIFICATION_TAG

Added in 1.5.0
const val EXTRA_NOTIFICATION_TAG = "android.intent.extra.NOTIFICATION_TAG": String!

Optional extra for INTENT_CATEGORY_NOTIFICATION_PREFERENCES. If provided, will contain the tag provided to notify that can be used to narrow down what settings should be shown in the target app.

EXTRA_PEOPLE

Added in 1.1.0
Deprecated in 1.5.0
const val EXTRA_PEOPLE = "android.people": String!

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

EXTRA_PEOPLE_LIST

Added in 1.5.0
const val EXTRA_PEOPLE_LIST = "android.people.list": String!

extras key: : An arrayList of Person objects containing the people that this notification relates to, each of which was supplied to addPerson.

EXTRA_PICTURE

Added in 1.1.0
const val EXTRA_PICTURE = "android.picture": String!

extras key: this is a bitmap to be shown in BigPictureStyle expanded notifications, supplied to bigPicture.

EXTRA_PICTURE_CONTENT_DESCRIPTION

Added in 1.8.0
const val EXTRA_PICTURE_CONTENT_DESCRIPTION = "android.pictureContentDescription": String!

extras key: this is a content description of the big picture supplied from bigPicture, supplied to setContentDescription.

EXTRA_PICTURE_ICON

Added in 1.9.0
const val EXTRA_PICTURE_ICON = "android.pictureIcon": String!

extras key: this is an Icon of an image to be shown in Notification.BigPictureStyle expanded notifications, supplied to bigPicture.

EXTRA_PROGRESS

Added in 1.1.0
const val EXTRA_PROGRESS = "android.progress": String!

extras key: this is the progress value supplied to setProgress.

EXTRA_PROGRESS_INDETERMINATE

Added in 1.1.0
const val EXTRA_PROGRESS_INDETERMINATE = "android.progressIndeterminate": String!

extras key: whether the progress bar is indeterminate, supplied to setProgress.

EXTRA_PROGRESS_MAX

Added in 1.1.0
const val EXTRA_PROGRESS_MAX = "android.progressMax": String!

extras key: this is the maximum value supplied to setProgress.

EXTRA_REMOTE_INPUT_HISTORY

Added in 1.1.0
const val EXTRA_REMOTE_INPUT_HISTORY = "android.remoteInputHistory": String!

extras key: this is the remote input history, as supplied to setRemoteInputHistory. Apps can fill this through setRemoteInputHistory 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.

EXTRA_SELF_DISPLAY_NAME

Added in 1.1.0
const val EXTRA_SELF_DISPLAY_NAME = "android.selfDisplayName": String!

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

EXTRA_SHOW_BIG_PICTURE_WHEN_COLLAPSED

Added in 1.7.0
const val EXTRA_SHOW_BIG_PICTURE_WHEN_COLLAPSED = "android.showBigPictureWhenCollapsed": String!

extras key: this is a boolean to indicate that the big picture is to be shown in the collapsed state of a BigPictureStyle notification. This will replace a large icon in that state if one was provided.

EXTRA_SHOW_CHRONOMETER

Added in 1.1.0
const val EXTRA_SHOW_CHRONOMETER = "android.showChronometer": String!

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

EXTRA_SHOW_WHEN

Added in 1.1.0
const val EXTRA_SHOW_WHEN = "android.showWhen": String!

extras key: whether the when field set using setWhen should be shown, as supplied to setShowWhen.

EXTRA_SMALL_ICON

Added in 1.1.0
const val EXTRA_SMALL_ICON = "android.icon": String!

extras key: this is the resource ID of the notification's main small icon, as supplied to setSmallIcon.

EXTRA_SUB_TEXT

Added in 1.1.0
const val EXTRA_SUB_TEXT = "android.subText": String!

extras key: this is a third line of text, as supplied to setSubText.

EXTRA_SUMMARY_TEXT

Added in 1.1.0
const val EXTRA_SUMMARY_TEXT = "android.summaryText": String!

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

EXTRA_TEMPLATE

Added in 1.1.0
const val EXTRA_TEMPLATE = "android.template": String!

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

EXTRA_TEXT

Added in 1.1.0
const val EXTRA_TEXT = "android.text": String!

extras key: this is the main text payload, as supplied to setContentText.

EXTRA_TEXT_LINES

Added in 1.1.0
const val EXTRA_TEXT_LINES = "android.textLines": String!

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

EXTRA_TITLE

Added in 1.1.0
const val EXTRA_TITLE = "android.title": String!

extras key: this is the title of the notification, as supplied to setContentTitle.

EXTRA_TITLE_BIG

Added in 1.1.0
const val EXTRA_TITLE_BIG = "android.title.big": String!

extras key: this is the title of the notification when shown in expanded form, e.g. as supplied to setBigContentTitle.

EXTRA_VERIFICATION_ICON

Added in 1.10.0
const val EXTRA_VERIFICATION_ICON = "android.verificationIcon": String!

extras key: the icon to be displayed as a verification status of the caller on a android.app.Notification.CallStyle notification. This extra is an Icon.

EXTRA_VERIFICATION_ICON_COMPAT

Added in 1.10.0
const val EXTRA_VERIFICATION_ICON_COMPAT = "android.verificationIconCompat": String!

extras key: the icon to be displayed as a verification status of the caller on a android.app.Notification.CallStyle notification, for Android versions before the Icon class was introduced. This extra is an Bundle representing an Icon.

EXTRA_VERIFICATION_TEXT

Added in 1.10.0
const val EXTRA_VERIFICATION_TEXT = "android.verificationText": String!

extras key: the text to be displayed as a verification status of the caller on a android.app.Notification.CallStyle notification. This extra is a CharSequence.

FLAG_AUTO_CANCEL

Added in 1.1.0
const val FLAG_AUTO_CANCEL = 16: Int

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

FLAG_BUBBLE

Added in 1.2.0
const val FLAG_BUBBLE = 4096: 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 setBubbleMetadata 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.

FLAG_FOREGROUND_SERVICE

Added in 1.1.0
const val FLAG_FOREGROUND_SERVICE = 64: Int

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

FLAG_GROUP_SUMMARY

Added in 1.1.0
const val FLAG_GROUP_SUMMARY = 512: 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 setGroup.

FLAG_HIGH_PRIORITY

Added in 1.1.0
Deprecated in 1.1.0
const val FLAG_HIGH_PRIORITY = 128: Int

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

FLAG_INSISTENT

Added in 1.1.0
const val FLAG_INSISTENT = 4: 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.

FLAG_LOCAL_ONLY

Added in 1.1.0
const val FLAG_LOCAL_ONLY = 256: 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.

FLAG_NO_CLEAR

Added in 1.1.0
const val FLAG_NO_CLEAR = 32: Int

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

FLAG_ONGOING_EVENT

Added in 1.1.0
const val FLAG_ONGOING_EVENT = 2: 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.

FLAG_ONLY_ALERT_ONCE

Added in 1.1.0
const val FLAG_ONLY_ALERT_ONCE = 8: 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.

FLAG_SHOW_LIGHTS

Added in 1.1.0
const val FLAG_SHOW_LIGHTS = 1: Int

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

FOREGROUND_SERVICE_DEFAULT

Added in 1.7.0
const val FOREGROUND_SERVICE_DEFAULT = 0: Int

Constant for setForegroundServiceBehavior. In Android 12 or later, if the Notification associated with starting a foreground service has been built using setForegroundServiceBehavior() with this behavior, display of the notification will often be suppressed for a short time to avoid visual disturbances to the user.

FOREGROUND_SERVICE_DEFERRED

Added in 1.7.0
const val FOREGROUND_SERVICE_DEFERRED = 2: Int

Constant for setForegroundServiceBehavior. In Android 12 or later, if the Notification associated with starting a foreground service has been built using setForegroundServiceBehavior() with this behavior, display of the notification will usually be suppressed for a short time to avoid visual disturbances to the user.

FOREGROUND_SERVICE_IMMEDIATE

Added in 1.7.0
const val FOREGROUND_SERVICE_IMMEDIATE = 1: Int

Constant for setForegroundServiceBehavior. In Android 12 or later, if the Notification associated with starting a foreground service has been built using setForegroundServiceBehavior() with this behavior, display of the notification will be immediate even if the default behavior would be to defer visibility for a short time.

GROUP_ALERT_ALL

Added in 1.1.0
const val GROUP_ALERT_ALL = 0: Int

Constant for setGroupAlertBehavior, 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.

GROUP_ALERT_CHILDREN

Added in 1.1.0
const val GROUP_ALERT_CHILDREN = 2: Int

Constant for setGroupAlertBehavior, 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.

GROUP_ALERT_SUMMARY

Added in 1.1.0
const val GROUP_ALERT_SUMMARY = 1: Int

Constant for setGroupAlertBehavior, 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.

GROUP_KEY_SILENT

Added in 1.3.0
const val GROUP_KEY_SILENT = "silent": String!

Constant for the group key that's added to notifications that are not already grouped when setNotificationSilent is used when SDK_INT is >= O.

INTENT_CATEGORY_NOTIFICATION_PREFERENCES

Added in 1.5.0
const val INTENT_CATEGORY_NOTIFICATION_PREFERENCES = "android.intent.category.NOTIFICATION_PREFERENCES": String!

An activity that provides a user interface for adjusting notification preferences for its containing application.

PRIORITY_DEFAULT

Added in 1.1.0
const val PRIORITY_DEFAULT = 0: Int

Default notification priority for setPriority. If your application does not prioritize its own notifications, use this value for all notifications.

PRIORITY_HIGH

Added in 1.1.0
const val PRIORITY_HIGH = 1: Int

Higher notification priority for setPriority, 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.

PRIORITY_LOW

Added in 1.1.0
const val PRIORITY_LOW = -1: Int

Lower notification priority for setPriority, 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.

PRIORITY_MAX

Added in 1.1.0
const val PRIORITY_MAX = 2: Int

Highest notification priority for setPriority, for your application's most important items that require the user's prompt attention or input.

PRIORITY_MIN

Added in 1.1.0
const val PRIORITY_MIN = -2: Int

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

STREAM_DEFAULT

Added in 1.1.0
const val STREAM_DEFAULT = -1: 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 STREAM_NOTIFICATION.

VISIBILITY_PRIVATE

Added in 1.1.0
const val VISIBILITY_PRIVATE = 0: Int

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

VISIBILITY_PUBLIC

Added in 1.1.0
const val VISIBILITY_PUBLIC = 1: Int

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

VISIBILITY_SECRET

Added in 1.1.0
const val VISIBILITY_SECRET = -1: Int

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

Public constructors

NotificationCompat

Added in 1.1.0
Deprecated in 1.1.0
NotificationCompat()

Public functions

getAction

Added in 1.1.0
java-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: Int

The index of the action to retrieve.

getActionCount

Added in 1.1.0
java-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

Added in 1.2.0
java-static fun getAllowSystemGeneratedContextualActions(notification: Notification): Boolean

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

getAutoCancel

Added in 1.5.0
java-static fun getAutoCancel(notification: Notification): Boolean

Get the value provided to setAutoCancel

getBadgeIconType

Added in 1.1.0
java-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

Added in 1.2.0
java-static fun getBubbleMetadata(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

Returns
NotificationCompat.BubbleMetadata?

the BubbleMetadata if available and set, otherwise null

getCategory

Added in 1.1.0
java-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

Added in 1.1.0
java-static fun getChannelId(notification: Notification): String?
Returns
String?

the ID of the channel this notification posts to.

getColor

Added in 1.5.0
java-static fun getColor(notification: Notification): Int

Get the value provided to setColor

getContentInfo

Added in 1.5.0
java-static fun getContentInfo(notification: Notification): CharSequence?

Returns the content info provided to setContentInfo.

getContentText

Added in 1.5.0
java-static fun getContentText(notification: Notification): CharSequence?

Returns the content text provided to setContentText.

getContentTitle

Added in 1.1.0
java-static fun getContentTitle(notification: Notification): CharSequence?

Returns the content title provided to setContentTitle.

getExtras

Added in 1.1.0
Deprecated in 1.15.0
@ReplaceWith(expression = "notification.extras")
java-static fun getExtras(notification: Notification): Bundle?

Gets the 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

Added in 1.1.0
java-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

Added in 1.1.0
java-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

Added in 1.1.0
@RequiresApi(value = 21)
java-static fun getInvisibleActions(notification: Notification): (Mutable)List<NotificationCompat.Action!>

Returns the invisible actions contained within the given notification.

getLocalOnly

Added in 1.1.0
java-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.

getLocusId

Added in 1.5.0
java-static fun getLocusId(notification: Notification): LocusIdCompat?

Gets the LocusIdCompat associated with this notification.

Used by the Android system to correlate objects (such as androidx.core.content.pm.ShortcutInfoCompat and android.view.contentcapture.ContentCaptureContext).

getOngoing

Added in 1.5.0
java-static fun getOngoing(notification: Notification): Boolean

Get the value provided to setOngoing

getOnlyAlertOnce

Added in 1.5.0
java-static fun getOnlyAlertOnce(notification: Notification): Boolean

Get the value provided to setOnlyAlertOnce

getPeople

Added in 1.5.0
java-static fun getPeople(notification: Notification): (Mutable)List<Person!>

Returns the people in the notification. On platforms which do not have the android.app.Person class, the Person objects will contain only the URI from addPerson.

getPublicVersion

Added in 1.5.0
java-static fun getPublicVersion(notification: Notification): Notification?

Get the value provided to setVisibility

getSettingsText

Added in 1.5.0
java-static fun getSettingsText(notification: Notification): CharSequence?

Returns the settings text provided to setSettingsText.

getShortcutId

Added in 1.1.0
java-static fun getShortcutId(notification: Notification): String?

Returns the id that this notification supersedes, if any.

getShowWhen

Added in 1.5.0
java-static fun getShowWhen(notification: Notification): Boolean

Get the value provided to setShowWhen

getSortKey

Added in 1.1.0
java-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 setGroup.

See also
compareTo

getSubText

Added in 1.5.0
java-static fun getSubText(notification: Notification): CharSequence?

Returns the sub text provided to setSubText.

getTimeoutAfter

Added in 1.1.0
java-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.

getUsesChronometer

Added in 1.5.0
java-static fun getUsesChronometer(notification: Notification): Boolean

Get the value provided to setUsesChronometer

getVisibility

Added in 1.5.0
java-static fun getVisibility(notification: Notification): Int

Get the value provided to setVisibility

isGroupSummary

Added in 1.1.0
java-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 setGroup.

Returns
Boolean

Whether this notification is a group summary.

reduceLargeIconSize

Added in 1.11.0
java-static fun reduceLargeIconSize(context: Context, icon: Bitmap?): Bitmap?

Reduces the size of a provided icon if it's larger than the maximum allowed for a notification large icon; returns the resized icon. Note that the framework does this scaling automatically starting from API 27.