NotificationCompat

Added in 1.1.0

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

public abstract class NotificationCompat.Style

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

static final int

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

static final int

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

static final int

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

static final String
CATEGORY_ALARM = "alarm"

Notification category: alarm or timer.

static final String
CATEGORY_CALL = "call"

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

static final String
CATEGORY_EMAIL = "email"

Notification category: asynchronous bulk message (email).

static final String

Notification category: error in background operation or authentication status.

static final String
CATEGORY_EVENT = "event"

Notification category: calendar event.

static final String
CATEGORY_LOCATION_SHARING = "location_sharing"

Notification category: temporarily sharing location.

static final String

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

static final String
CATEGORY_MISSED_CALL = "missed_call"

Notification category: missed call.

static final String
CATEGORY_NAVIGATION = "navigation"

Notification category: map turn-by-turn navigation.

static final String
CATEGORY_PROGRESS = "progress"

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

static final String
CATEGORY_PROMO = "promo"

Notification category: promotion or advertisement.

static final String
CATEGORY_RECOMMENDATION = "recommendation"

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

static final String
CATEGORY_REMINDER = "reminder"

Notification category: user-scheduled reminder.

static final String
CATEGORY_SERVICE = "service"

Notification category: indication of running background service.

static final String
CATEGORY_SOCIAL = "social"

Notification category: social network or sharing update.

static final String
CATEGORY_STATUS = "status"

Notification category: ongoing information about device or contextual status.

static final String
CATEGORY_STOPWATCH = "stopwatch"

Notification category: running stopwatch.

static final String

Notification category: system or device status update.

static final String
CATEGORY_TRANSPORT = "transport"

Notification category: media transport control for playback.

static final String
CATEGORY_WORKOUT = "workout"

Notification category: tracking a user's workout.

static final @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.

static final int

Use all default values (where applicable).

static final int

Use the default notification lights.

static final int

Use the default notification sound.

static final int

Use the default notification vibrate.

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

static final String
EXTRA_ANSWER_INTENT = "android.answerIntent"

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

static final String
EXTRA_AUDIO_CONTENTS_URI = "android.audioContents"

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

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

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

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

static final String
EXTRA_CALL_PERSON = "android.callPerson"

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

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

static final String
EXTRA_CALL_TYPE = "android.callType"

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

static final String
EXTRA_CHANNEL_GROUP_ID = "android.intent.extra.CHANNEL_GROUP_ID"

Optional extra for INTENT_CATEGORY_NOTIFICATION_PREFERENCES.

static final String
EXTRA_CHANNEL_ID = "android.intent.extra.CHANNEL_ID"

Optional extra for INTENT_CATEGORY_NOTIFICATION_PREFERENCES.

static final String
EXTRA_CHRONOMETER_COUNT_DOWN = "android.chronometerCountDown"

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

static final String
EXTRA_COLORIZED = "android.colorized"

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

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

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

static final String
EXTRA_CONVERSATION_TITLE = "android.conversationTitle"

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

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

static final String
EXTRA_DECLINE_INTENT = "android.declineIntent"

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

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

static final String
EXTRA_HIDDEN_CONVERSATION_TITLE = "android.hiddenConversationTitle"

Key for compat's getConversationTitle.

static final String
EXTRA_HISTORIC_MESSAGES = "android.messages.historic"

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

static final String
EXTRA_INFO_TEXT = "android.infoText"

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

static final String
EXTRA_IS_GROUP_CONVERSATION = "android.isGroupConversation"

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

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

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

static final String
EXTRA_MEDIA_SESSION = "android.mediaSession"

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

static final String
EXTRA_MESSAGES = "android.messages"

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

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

static final String
EXTRA_NOTIFICATION_ID = "android.intent.extra.NOTIFICATION_ID"

Optional extra for INTENT_CATEGORY_NOTIFICATION_PREFERENCES.

static final String
EXTRA_NOTIFICATION_TAG = "android.intent.extra.NOTIFICATION_TAG"

Optional extra for INTENT_CATEGORY_NOTIFICATION_PREFERENCES.

static final String
EXTRA_PEOPLE = "android.people"

This field is deprecated.

the actual objects are now in EXTRA_PEOPLE_LIST

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

static final String
EXTRA_PICTURE = "android.picture"

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

static final String
EXTRA_PICTURE_CONTENT_DESCRIPTION = "android.pictureContentDescription"

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

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

static final String
EXTRA_PROGRESS = "android.progress"

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

static final String
EXTRA_PROGRESS_INDETERMINATE = "android.progressIndeterminate"

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

static final String
EXTRA_PROGRESS_MAX = "android.progressMax"

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

static final String
EXTRA_REMOTE_INPUT_HISTORY = "android.remoteInputHistory"

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

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

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

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

static final String
EXTRA_SHOW_WHEN = "android.showWhen"

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

static final String
EXTRA_SMALL_ICON = "android.icon"

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

static final String
EXTRA_SUB_TEXT = "android.subText"

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

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

static final String
EXTRA_TEMPLATE = "android.template"

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

static final String
EXTRA_TEXT = "android.text"

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

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

static final String
EXTRA_TITLE = "android.title"

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

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

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

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

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

static final int

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

static final int

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

static final int

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

static final int

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

static final int

This field is deprecated.

Use setPriority with a positive value.

static final 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 final 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 final int

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

static final int

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

static final 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 final int

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

static final int

Constant for setForegroundServiceBehavior.

static final int

Constant for setForegroundServiceBehavior.

static final int

Constant for setForegroundServiceBehavior.

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

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

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

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

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

static final int

Default notification priority for setPriority.

static final int

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

static final int

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

static final int

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

static final int

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

static final int

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

static final int

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

static final int

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

static final int

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

Public constructors

This method is deprecated.

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

Public methods

static @Nullable NotificationCompat.Action
getAction(@NonNull Notification notification, int actionIndex)

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

static int

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

static boolean

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

static boolean

Get the value provided to setAutoCancel

static int

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

static @Nullable 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.

static @Nullable String

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

static @Nullable String
static int
getColor(@NonNull Notification notification)

Get the value provided to setColor

static @Nullable CharSequence

Returns the content info provided to setContentInfo.

static @Nullable CharSequence

Returns the content text provided to setContentText.

static @Nullable CharSequence

Returns the content title provided to setContentTitle.

static @Nullable Bundle

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

static @Nullable String
getGroup(@NonNull Notification notification)

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

static int

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

static @NonNull List<NotificationCompat.Action>
@RequiresApi(value = 21)
getInvisibleActions(@NonNull Notification notification)

Returns the invisible actions contained within the given notification.

static boolean

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

static @Nullable LocusIdCompat

Gets the LocusIdCompat associated with this notification.

static boolean

Get the value provided to setOngoing

static boolean

Get the value provided to setOnlyAlertOnce

static @NonNull List<Person>

Returns the people in the notification.

static @Nullable Notification

Get the value provided to setVisibility

static @Nullable CharSequence

Returns the settings text provided to setSettingsText.

static @Nullable String

Returns the id that this notification supersedes, if any.

static boolean

Get the value provided to setShowWhen

static @Nullable String

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

static @Nullable CharSequence

Returns the sub text provided to setSubText.

static long

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

static boolean

Get the value provided to setUsesChronometer

static int

Get the value provided to setVisibility

static boolean

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

static @Nullable 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
public static final int BADGE_ICON_LARGE = 2

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
public static final int BADGE_ICON_NONE = 0

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

BADGE_ICON_SMALL

Added in 1.1.0
public static final int BADGE_ICON_SMALL = 1

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
public static final String CATEGORY_ALARM = "alarm"

Notification category: alarm or timer.

CATEGORY_CALL

Added in 1.1.0
public static final String CATEGORY_CALL = "call"

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

CATEGORY_EMAIL

Added in 1.1.0
public static final String CATEGORY_EMAIL = "email"

Notification category: asynchronous bulk message (email).

CATEGORY_ERROR

Added in 1.1.0
public static final String CATEGORY_ERROR = "err"

Notification category: error in background operation or authentication status.

CATEGORY_EVENT

Added in 1.1.0
public static final String CATEGORY_EVENT = "event"

Notification category: calendar event.

CATEGORY_LOCATION_SHARING

Added in 1.5.0
public static final String CATEGORY_LOCATION_SHARING = "location_sharing"

Notification category: temporarily sharing location.

CATEGORY_MESSAGE

Added in 1.1.0
public static final String CATEGORY_MESSAGE = "msg"

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

CATEGORY_MISSED_CALL

Added in 1.5.0
public static final String CATEGORY_MISSED_CALL = "missed_call"

Notification category: missed call.

CATEGORY_NAVIGATION

Added in 1.1.0
public static final String CATEGORY_NAVIGATION = "navigation"

Notification category: map turn-by-turn navigation.

CATEGORY_PROGRESS

Added in 1.1.0
public static final String CATEGORY_PROGRESS = "progress"

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

CATEGORY_PROMO

Added in 1.1.0
public static final String CATEGORY_PROMO = "promo"

Notification category: promotion or advertisement.

CATEGORY_RECOMMENDATION

Added in 1.1.0
public static final String CATEGORY_RECOMMENDATION = "recommendation"

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
public static final String CATEGORY_REMINDER = "reminder"

Notification category: user-scheduled reminder.

CATEGORY_SERVICE

Added in 1.1.0
public static final String CATEGORY_SERVICE = "service"

Notification category: indication of running background service.

CATEGORY_SOCIAL

Added in 1.1.0
public static final String CATEGORY_SOCIAL = "social"

Notification category: social network or sharing update.

CATEGORY_STATUS

Added in 1.1.0
public static final String CATEGORY_STATUS = "status"

Notification category: ongoing information about device or contextual status.

CATEGORY_STOPWATCH

Added in 1.5.0
public static final String CATEGORY_STOPWATCH = "stopwatch"

Notification category: running stopwatch.

CATEGORY_SYSTEM

Added in 1.1.0
public static final String CATEGORY_SYSTEM = "sys"

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

CATEGORY_TRANSPORT

Added in 1.1.0
public static final String CATEGORY_TRANSPORT = "transport"

Notification category: media transport control for playback.

CATEGORY_WORKOUT

Added in 1.5.0
public static final String CATEGORY_WORKOUT = "workout"

Notification category: tracking a user's workout.

COLOR_DEFAULT

Added in 1.1.0
public static final @ColorInt int COLOR_DEFAULT = 0

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
public static final int DEFAULT_ALL = -1

Use all default values (where applicable).

DEFAULT_LIGHTS

Added in 1.1.0
public static final int DEFAULT_LIGHTS = 4

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
public static final int DEFAULT_SOUND = 1

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
public static final int DEFAULT_VIBRATE = 2

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
public static final 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. This extra is a ColorInt.

EXTRA_ANSWER_INTENT

Added in 1.10.0
public static final String EXTRA_ANSWER_INTENT = "android.answerIntent"

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
public static final String EXTRA_AUDIO_CONTENTS_URI = "android.audioContents"

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
public static final 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. 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
public static final 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.

EXTRA_CALL_IS_VIDEO

Added in 1.10.0
public static final 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. This extra is a boolean.

EXTRA_CALL_PERSON

Added in 1.10.0
public static final String EXTRA_CALL_PERSON = "android.callPerson"

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
public static final 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. This extra is a Bundle representing a Person.

EXTRA_CALL_TYPE

Added in 1.10.0
public static final String EXTRA_CALL_TYPE = "android.callType"

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
public static final String EXTRA_CHANNEL_GROUP_ID = "android.intent.extra.CHANNEL_GROUP_ID"

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
public static final String EXTRA_CHANNEL_ID = "android.intent.extra.CHANNEL_ID"

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
public static final String EXTRA_CHRONOMETER_COUNT_DOWN = "android.chronometerCountDown"

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
public static final String EXTRA_COLORIZED = "android.colorized"

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

EXTRA_COMPACT_ACTIONS

Added in 1.1.0
public static final 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.

EXTRA_COMPAT_TEMPLATE

Added in 1.5.0
public static final 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.

EXTRA_CONVERSATION_TITLE

Added in 1.1.0
public static final String EXTRA_CONVERSATION_TITLE = "android.conversationTitle"

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
public static final 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. This extra is a ColorInt.

EXTRA_DECLINE_INTENT

Added in 1.10.0
public static final String EXTRA_DECLINE_INTENT = "android.declineIntent"

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
public static final 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. This extra is a PendingIntent.

EXTRA_HIDDEN_CONVERSATION_TITLE

Added in 1.1.0
public static final String EXTRA_HIDDEN_CONVERSATION_TITLE = "android.hiddenConversationTitle"

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

EXTRA_HISTORIC_MESSAGES

Added in 1.5.0
public static final String EXTRA_HISTORIC_MESSAGES = "android.messages.historic"

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
public static final String EXTRA_INFO_TEXT = "android.infoText"

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

EXTRA_IS_GROUP_CONVERSATION

Added in 1.1.0
public static final String EXTRA_IS_GROUP_CONVERSATION = "android.isGroupConversation"

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

EXTRA_LARGE_ICON

Added in 1.1.0
public static final 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.

EXTRA_LARGE_ICON_BIG

Added in 1.1.0
public static final 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.

EXTRA_MEDIA_SESSION

Added in 1.1.0
public static final String EXTRA_MEDIA_SESSION = "android.mediaSession"

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

EXTRA_MESSAGES

Added in 1.1.0
public static final String EXTRA_MESSAGES = "android.messages"

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
public static final 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.

EXTRA_NOTIFICATION_ID

Added in 1.5.0
public static final String EXTRA_NOTIFICATION_ID = "android.intent.extra.NOTIFICATION_ID"

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
public static final String EXTRA_NOTIFICATION_TAG = "android.intent.extra.NOTIFICATION_TAG"

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
public static final String EXTRA_PEOPLE = "android.people"

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
public static final 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.

EXTRA_PICTURE

Added in 1.1.0
public static final String EXTRA_PICTURE = "android.picture"

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
public static final String EXTRA_PICTURE_CONTENT_DESCRIPTION = "android.pictureContentDescription"

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
public static final 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.

EXTRA_PROGRESS

Added in 1.1.0
public static final String EXTRA_PROGRESS = "android.progress"

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

EXTRA_PROGRESS_INDETERMINATE

Added in 1.1.0
public static final String EXTRA_PROGRESS_INDETERMINATE = "android.progressIndeterminate"

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

EXTRA_PROGRESS_MAX

Added in 1.1.0
public static final String EXTRA_PROGRESS_MAX = "android.progressMax"

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

EXTRA_REMOTE_INPUT_HISTORY

Added in 1.1.0
public static final String EXTRA_REMOTE_INPUT_HISTORY = "android.remoteInputHistory"

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
public static final 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.

EXTRA_SHOW_BIG_PICTURE_WHEN_COLLAPSED

Added in 1.7.0
public static final 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. This will replace a large icon in that state if one was provided.

EXTRA_SHOW_CHRONOMETER

Added in 1.1.0
public static final 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.

EXTRA_SHOW_WHEN

Added in 1.1.0
public static final String EXTRA_SHOW_WHEN = "android.showWhen"

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

EXTRA_SMALL_ICON

Added in 1.1.0
public static final String EXTRA_SMALL_ICON = "android.icon"

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
public static final String EXTRA_SUB_TEXT = "android.subText"

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

EXTRA_SUMMARY_TEXT

Added in 1.1.0
public static final 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.

EXTRA_TEMPLATE

Added in 1.1.0
public static final String EXTRA_TEMPLATE = "android.template"

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
public static final String EXTRA_TEXT = "android.text"

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

EXTRA_TEXT_LINES

Added in 1.1.0
public static final 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.

EXTRA_TITLE

Added in 1.1.0
public static final String EXTRA_TITLE = "android.title"

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

EXTRA_TITLE_BIG

Added in 1.1.0
public static final 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.

EXTRA_VERIFICATION_ICON

Added in 1.10.0
public static final 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. This extra is an Icon.

EXTRA_VERIFICATION_ICON_COMPAT

Added in 1.10.0
public static final 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. This extra is an Bundle representing an Icon.

EXTRA_VERIFICATION_TEXT

Added in 1.10.0
public static final 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. This extra is a CharSequence.

FLAG_AUTO_CANCEL

Added in 1.1.0
public static final int FLAG_AUTO_CANCEL = 16

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
public static final int FLAG_BUBBLE = 4096

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
public static final int FLAG_FOREGROUND_SERVICE = 64

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
public static final int FLAG_GROUP_SUMMARY = 512

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
public static final int FLAG_HIGH_PRIORITY = 128

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

FLAG_INSISTENT

Added in 1.1.0
public static final int FLAG_INSISTENT = 4

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
public static final int FLAG_LOCAL_ONLY = 256

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
public static final int FLAG_NO_CLEAR = 32

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
public static final int FLAG_ONGOING_EVENT = 2

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
public static final int FLAG_ONLY_ALERT_ONCE = 8

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
public static final int FLAG_SHOW_LIGHTS = 1

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

FOREGROUND_SERVICE_DEFAULT

Added in 1.7.0
public static final int FOREGROUND_SERVICE_DEFAULT = 0

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
public static final int FOREGROUND_SERVICE_DEFERRED = 2

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
public static final int FOREGROUND_SERVICE_IMMEDIATE = 1

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
public static final int GROUP_ALERT_ALL = 0

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
public static final int GROUP_ALERT_CHILDREN = 2

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
public static final int GROUP_ALERT_SUMMARY = 1

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
public static final 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.

INTENT_CATEGORY_NOTIFICATION_PREFERENCES

Added in 1.5.0
public static final 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.

PRIORITY_DEFAULT

Added in 1.1.0
public static final int PRIORITY_DEFAULT = 0

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
public static final int PRIORITY_HIGH = 1

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
public static final int PRIORITY_LOW = -1

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
public static final int PRIORITY_MAX = 2

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
public static final int PRIORITY_MIN = -2

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
public static final int STREAM_DEFAULT = -1

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
public static final int VISIBILITY_PRIVATE = 0

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
public static final int VISIBILITY_PUBLIC = 1

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

VISIBILITY_SECRET

Added in 1.1.0
public static final int VISIBILITY_SECRET = -1

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
public NotificationCompat()

Public methods

getAction

Added in 1.1.0
public static @Nullable NotificationCompat.Action getAction(@NonNull Notification notification, int actionIndex)

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

Parameters
@NonNull Notification notification

The notification to inspect.

int actionIndex

The index of the action to retrieve.

getActionCount

Added in 1.1.0
public static int getActionCount(@NonNull Notification notification)

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
public static boolean getAllowSystemGeneratedContextualActions(
    @NonNull Notification notification
)

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

getAutoCancel

Added in 1.5.0
public static boolean getAutoCancel(@NonNull Notification notification)

Get the value provided to setAutoCancel

getBadgeIconType

Added in 1.1.0
public static int getBadgeIconType(@NonNull Notification notification)

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
public static @Nullable 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.

Parameters
@NonNull Notification notification

the notification to inspect

Returns
@Nullable NotificationCompat.BubbleMetadata

the BubbleMetadata if available and set, otherwise null

getCategory

Added in 1.1.0
public static @Nullable String getCategory(@NonNull Notification notification)

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

Parameters
@NonNull Notification notification

The notification to inspect.

getChannelId

Added in 1.1.0
public static @Nullable String getChannelId(@NonNull Notification notification)
Returns
@Nullable String

the ID of the channel this notification posts to.

getColor

Added in 1.5.0
public static int getColor(@NonNull Notification notification)

Get the value provided to setColor

getContentInfo

Added in 1.5.0
public static @Nullable CharSequence getContentInfo(@NonNull Notification notification)

Returns the content info provided to setContentInfo.

getContentText

Added in 1.5.0
public static @Nullable CharSequence getContentText(@NonNull Notification notification)

Returns the content text provided to setContentText.

getContentTitle

Added in 1.1.0
public static @Nullable CharSequence getContentTitle(@NonNull Notification notification)

Returns the content title provided to setContentTitle.

getExtras

Added in 1.1.0
public static @Nullable Bundle getExtras(@NonNull Notification notification)

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
public static @Nullable String getGroup(@NonNull Notification notification)

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
public static int getGroupAlertBehavior(@NonNull Notification notification)

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)
public static @NonNull List<NotificationCompat.ActiongetInvisibleActions(@NonNull Notification notification)

Returns the invisible actions contained within the given notification.

getLocalOnly

Added in 1.1.0
public static boolean getLocalOnly(@NonNull Notification notification)

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
public static @Nullable LocusIdCompat getLocusId(@NonNull Notification notification)

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
public static boolean getOngoing(@NonNull Notification notification)

Get the value provided to setOngoing

getOnlyAlertOnce

Added in 1.5.0
public static boolean getOnlyAlertOnce(@NonNull Notification notification)

Get the value provided to setOnlyAlertOnce

getPeople

Added in 1.5.0
public static @NonNull List<PersongetPeople(@NonNull Notification notification)

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
public static @Nullable Notification getPublicVersion(@NonNull Notification notification)

Get the value provided to setVisibility

getSettingsText

Added in 1.5.0
public static @Nullable CharSequence getSettingsText(@NonNull Notification notification)

Returns the settings text provided to setSettingsText.

getShortcutId

Added in 1.1.0
public static @Nullable String getShortcutId(@NonNull Notification notification)

Returns the id that this notification supersedes, if any.

getShowWhen

Added in 1.5.0
public static boolean getShowWhen(@NonNull Notification notification)

Get the value provided to setShowWhen

getSortKey

Added in 1.1.0
public static @Nullable String getSortKey(@NonNull Notification notification)

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
public static @Nullable CharSequence getSubText(@NonNull Notification notification)

Returns the sub text provided to setSubText.

getTimeoutAfter

Added in 1.1.0
public static long getTimeoutAfter(@NonNull Notification notification)

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
public static boolean getUsesChronometer(@NonNull Notification notification)

Get the value provided to setUsesChronometer

getVisibility

Added in 1.5.0
public static int getVisibility(@NonNull Notification notification)

Get the value provided to setVisibility

isGroupSummary

Added in 1.1.0
public static boolean isGroupSummary(@NonNull Notification notification)

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
public static @Nullable Bitmap reduceLargeIconSize(@NonNull Context context, @Nullable Bitmap icon)

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.