NotificationCompat
public class NotificationCompat
Helper for accessing features in android.app.Notification.
Summary
Nested types |
|---|
public class NotificationCompat.ActionStructure to encapsulate a named action that can be shown as part of this notification. |
public final class NotificationCompat.Action.BuilderBuilder class for |
public interface NotificationCompat.Action.ExtenderExtender interface for use with |
@IntDef(value = )Provides meaning to an |
public final class NotificationCompat.Action.WearableExtender implements NotificationCompat.Action.ExtenderWearable extender for notification actions. |
public class NotificationCompat.BigPictureStyle extends NotificationCompat.StyleHelper class for generating large-format notifications that include a large image attachment. |
public class NotificationCompat.BigTextStyle extends NotificationCompat.StyleHelper class for generating large-format notifications that include a lot of text. |
public final class NotificationCompat.BubbleMetadataEncapsulates the information needed to display a notification as a bubble. |
public final class NotificationCompat.BubbleMetadata.BuilderBuilder to construct a |
public class NotificationCompat.BuilderBuilder class for |
public class NotificationCompat.CallStyle extends NotificationCompat.StyleHelper class for generating large-format notifications that include a caller and required actions, and indicate an incoming call. |
public final class NotificationCompat.CarExtender implements NotificationCompat.ExtenderHelper class to add Android Auto extensions to notifications. |
public class NotificationCompat.CarExtender.UnreadConversationThis class is deprecated.
|
|
Builder class for |
public class NotificationCompat.DecoratedCustomViewStyle extends NotificationCompat.StyleNotification style for custom views that are decorated by the system. |
public interface NotificationCompat.ExtenderExtender interface for use with |
public class NotificationCompat.InboxStyle extends NotificationCompat.StyleHelper class for generating large-format notifications that include a list of (up to 5) strings. |
public class NotificationCompat.MessagingStyle extends NotificationCompat.StyleHelper class for generating large-format notifications that include multiple back-and-forth messages of varying types between any number of people. |
public final class NotificationCompat.MessagingStyle.Message |
public class NotificationCompat.ProgressStyle extends NotificationCompat.StyleHelper class for generating large-format notifications that display progress to the user with a highly customizable progress bar with segments, points, a custom tracker icon, and custom icons at the start and end of the progress bar. |
public final class NotificationCompat.ProgressStyle.PointA point within the progress bar, defining its position and color. |
public final class NotificationCompat.ProgressStyle.SegmentA segment of the progress bar, which defines its length and color. |
public abstract class NotificationCompat.StyleAn object that can apply a rich notification style to a |
public final class NotificationCompat.TvExtender implements NotificationCompat.ExtenderHelper class to add Android TV extensions to notifications. |
public final class NotificationCompat.WearableExtender implements NotificationCompat.ExtenderHelper class to add wearable extensions to notifications. |
Constants |
|
|---|---|
static final int |
BADGE_ICON_LARGE = 2If this notification is being shown as a badge, use the icon provided to |
static final int |
BADGE_ICON_NONE = 0If this notification is being shown as a badge, always show as a number. |
static final int |
BADGE_ICON_SMALL = 1If this notification is being shown as a badge, use the icon provided to |
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 |
CATEGORY_ERROR = "err"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 |
CATEGORY_MESSAGE = "msg"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 |
CATEGORY_SYSTEM = "sys"Notification category: system or device status update. |
static final String |
CATEGORY_TRANSPORT = "transport"Notification category: media transport control for playback. |
static final String |
CATEGORY_VOICEMAIL = "voicemail"Notification category: voicemail. |
static final String |
CATEGORY_WORKOUT = "workout"Notification category: tracking a user's workout. |
static final @ColorInt int |
COLOR_DEFAULT = 0Value of |
static final int |
DEFAULT_ALL = -1Use all default values (where applicable). |
static final int |
DEFAULT_LIGHTS = 4Use the default notification lights. |
static final int |
DEFAULT_SOUND = 1Use the default notification sound. |
static final int |
DEFAULT_VIBRATE = 2Use the default notification vibrate. |
static final String |
EXTRA_ANSWER_COLOR = "android.answerColor"
|
static final String |
EXTRA_ANSWER_INTENT = "android.answerIntent"
|
static final String |
EXTRA_AUDIO_CONTENTS_URI = "android.audioContents"Keys into the |
static final String |
EXTRA_BACKGROUND_IMAGE_URI = "android.backgroundImageUri"
|
static final String |
EXTRA_BIG_TEXT = "android.bigText"
|
static final String |
EXTRA_CALL_IS_VIDEO = "android.callIsVideo"
|
static final String |
EXTRA_CALL_PERSON = "android.callPerson"
|
static final String |
EXTRA_CALL_PERSON_COMPAT = "android.callPersonCompat"
|
static final String |
EXTRA_CALL_TYPE = "android.callType"
|
static final String |
EXTRA_CHANNEL_GROUP_ID = "android.intent.extra.CHANNEL_GROUP_ID"Optional extra for |
static final String |
EXTRA_CHANNEL_ID = "android.intent.extra.CHANNEL_ID"Optional extra for |
static final String |
EXTRA_CHRONOMETER_COUNT_DOWN = "android.chronometerCountDown"
|
static final String |
EXTRA_COLORIZED = "android.colorized"
|
static final String |
EXTRA_COMPACT_ACTIONS = "android.compactActions"
|
static final String |
EXTRA_COMPAT_TEMPLATE = "androidx.core.app.extra.COMPAT_TEMPLATE"
|
static final String |
EXTRA_CONVERSATION_TITLE = "android.conversationTitle"
|
static final String |
EXTRA_DECLINE_COLOR = "android.declineColor"
|
static final String |
EXTRA_DECLINE_INTENT = "android.declineIntent"
|
static final String |
EXTRA_HANG_UP_INTENT = "android.hangUpIntent"
|
static final String |
EXTRA_HIDDEN_CONVERSATION_TITLE = "android.hiddenConversationTitle"Key for compat's |
static final String |
EXTRA_HISTORIC_MESSAGES = "android.messages.historic"
|
static final String |
EXTRA_INFO_TEXT = "android.infoText"
|
static final String |
EXTRA_IS_GROUP_CONVERSATION = "android.isGroupConversation"
|
static final String |
EXTRA_LARGE_ICON = "android.largeIcon"
|
static final String |
EXTRA_LARGE_ICON_BIG = "android.largeIcon.big"
|
static final String |
EXTRA_MEDIA_SESSION = "android.mediaSession"Notification key: A |
static final String |
EXTRA_MESSAGES = "android.messages"
|
static final String |
EXTRA_MESSAGING_STYLE_USER = "android.messagingStyleUser"
|
static final String |
EXTRA_NOTIFICATION_ID = "android.intent.extra.NOTIFICATION_ID"Optional extra for |
static final String |
EXTRA_NOTIFICATION_TAG = "android.intent.extra.NOTIFICATION_TAG"Optional extra for |
static final String |
EXTRA_PEOPLE = "android.people"This field is deprecated. the actual objects are now in |
static final String |
EXTRA_PEOPLE_LIST = "android.people.list"
|
static final String |
EXTRA_PICTURE = "android.picture"
|
static final String |
EXTRA_PICTURE_CONTENT_DESCRIPTION = "android.pictureContentDescription"
|
static final String |
EXTRA_PICTURE_ICON = "android.pictureIcon"
|
static final String |
EXTRA_PROGRESS = "android.progress"
|
static final String |
EXTRA_PROGRESS_END_ICON = "android.progressEndIcon"extras key: this is an |
static final String |
EXTRA_PROGRESS_INDETERMINATE = "android.progressIndeterminate"
|
static final String |
EXTRA_PROGRESS_MAX = "android.progressMax"
|
static final String |
EXTRA_PROGRESS_POINTS = "android.progressPoints"extras key: an arraylist of |
static final String |
EXTRA_PROGRESS_SEGMENTS = "android.progressSegments"extras key: an arraylist of |
static final String |
EXTRA_PROGRESS_START_ICON = "android.progressStartIcon"extras key: this is an |
static final String |
EXTRA_PROGRESS_TRACKER_ICON = "android.progressTrackerIcon"extras key: this is an |
static final String |
EXTRA_REMOTE_INPUT_HISTORY = "android.remoteInputHistory"
|
static final String |
EXTRA_REQUEST_PROMOTED_ONGOING = "android.requestPromotedOngoing"
|
static final String |
EXTRA_SELF_DISPLAY_NAME = "android.selfDisplayName"
|
static final String |
EXTRA_SHORT_CRITICAL_TEXT = "android.shortCriticalText"
|
static final String |
EXTRA_SHOW_BIG_PICTURE_WHEN_COLLAPSED = "android.showBigPictureWhenCollapsed"
|
static final String |
EXTRA_SHOW_CHRONOMETER = "android.showChronometer"
|
static final String |
EXTRA_SHOW_WHEN = "android.showWhen"
|
static final String |
EXTRA_SMALL_ICON = "android.icon"
|
static final String |
EXTRA_STYLED_BY_PROGRESS = "android.styledByProgress"extras key: whether the progress bar should be styled by its progress as supplied to |
static final String |
EXTRA_SUB_TEXT = "android.subText"
|
static final String |
EXTRA_SUMMARY_TEXT = "android.summaryText"
|
static final String |
EXTRA_TEMPLATE = "android.template"
|
static final String |
EXTRA_TEXT = "android.text"
|
static final String |
EXTRA_TEXT_LINES = "android.textLines"
|
static final String |
EXTRA_TITLE = "android.title"
|
static final String |
EXTRA_TITLE_BIG = "android.title.big"
|
static final String |
EXTRA_VERIFICATION_ICON = "android.verificationIcon"
|
static final String |
EXTRA_VERIFICATION_ICON_COMPAT = "android.verificationIconCompat"
|
static final String |
EXTRA_VERIFICATION_TEXT = "android.verificationText"
|
static final int |
FLAG_AUTO_CANCEL = 16Bit set in the Notification flags field if the notification should be canceled when it is clicked by the user. |
static final int |
FLAG_BUBBLE = 4096Bit 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 |
FLAG_GROUP_SUMMARY = 512Bit set in the Notification flags field if this notification is the group summary for a group of notifications. |
static final int |
FLAG_HIGH_PRIORITY = 128This field is deprecated. Use |
static final int |
FLAG_INSISTENT = 4Bit 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 |
FLAG_LOCAL_ONLY = 256Bit 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 |
FLAG_NO_CLEAR = 32Bit 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 |
FLAG_SHOW_LIGHTS = 1Bit set in the Notification flags field when LEDs should be turned on for this notification. |
static final int |
Constant for |
static final int |
Constant for |
static final int |
Constant for |
static final int |
GROUP_ALERT_ALL = 0Constant for |
static final int |
Constant for |
static final int |
Constant for |
static final String |
GROUP_KEY_SILENT = "silent"Constant for the |
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 |
PRIORITY_DEFAULT = 0Default notification priority for |
static final int |
PRIORITY_HIGH = 1Higher notification priority for |
static final int |
PRIORITY_LOW = -1Lower notification priority for |
static final int |
PRIORITY_MAX = 2Highest notification priority for |
static final int |
PRIORITY_MIN = -2Lowest notification priority for |
static final int |
STREAM_DEFAULT = -1Use 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 |
VISIBILITY_SECRET = -1Notification 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 |
getActionCount(@NonNull Notification notification)Get the number of actions in this notification in a backwards compatible manner. |
static boolean |
getAllowSystemGeneratedContextualActions(Returns whether the platform is allowed (by the app developer) to generate contextual actions for this notification. |
static boolean |
getAutoCancel(@NonNull Notification notification)Get the value provided to |
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. |
static @Nullable NotificationCompat.BubbleMetadata |
getBubbleMetadata(@NonNull Notification notification)Get the |
static @Nullable String |
getCategory(@NonNull Notification notification)Get the category of this notification in a backwards compatible manner. |
static @Nullable String |
getChannelId(@NonNull Notification notification) |
static int |
getColor(@NonNull Notification notification)Get the value provided to |
static @Nullable CharSequence |
getContentInfo(@NonNull Notification notification)Returns the content info provided to |
static @Nullable CharSequence |
getContentText(@NonNull Notification notification)Returns the content text provided to |
static @Nullable CharSequence |
getContentTitle(@NonNull Notification notification)Returns the content title provided to |
static @Nullable Bundle |
@ReplaceWith(expression = "notification.extras")This method is deprecated. Call |
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 |
getGroupAlertBehavior(@NonNull Notification notification)Returns which type of notifications in a group are responsible for audibly alerting the user. |
static @NonNull List<NotificationCompat.Action> |
@RequiresApi(value = 21)Returns the invisible actions contained within the given notification. |
static boolean |
getLocalOnly(@NonNull Notification notification)Get whether or not this notification is only relevant to the current device. |
static @Nullable LocusIdCompat |
getLocusId(@NonNull Notification notification)Gets the |
static boolean |
getOngoing(@NonNull Notification notification)Get the value provided to |
static boolean |
getOnlyAlertOnce(@NonNull Notification notification)Get the value provided to |
static @NonNull List<Person> |
getPeople(@NonNull Notification notification)Returns the people in the notification. |
static @Nullable Notification |
getPublicVersion(@NonNull Notification notification)Get the value provided to |
static @Nullable CharSequence |
getSettingsText(@NonNull Notification notification)Returns the settings text provided to |
static @Nullable String |
getShortCriticalText(@NonNull Notification notification)Returns the very short text summarizing the most critical information contained in the notification, or null if this field was not set. |
static @Nullable String |
getShortcutId(@NonNull Notification notification)Returns the |
static boolean |
getShowWhen(@NonNull Notification notification)Get the value provided to |
static @Nullable String |
getSortKey(@NonNull Notification notification)Get a sort key that orders this notification among other notifications from the same package. |
static @Nullable CharSequence |
getSubText(@NonNull Notification notification)Returns the sub text provided to |
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. |
static boolean |
getUsesChronometer(@NonNull Notification notification)Get the value provided to |
static int |
getVisibility(@NonNull Notification notification)Get the value provided to |
static boolean |
hasPromotableCharacteristics(@NonNull Notification notification)Returns whether the notification has any promotable characteristics. |
static boolean |
isGroupSummary(@NonNull Notification notification)Get whether this notification to be the group summary for a group of notifications. |
static boolean |
isRequestPromotedOngoing(@NonNull Notification notification)Returns whether this notification has requested to be a promoted ongoing notification. |
static @Nullable Bitmap |
reduceLargeIconSize(@NonNull Context context, @Nullable Bitmap icon)Reduces the size of a provided |
Constants
BADGE_ICON_LARGE
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
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
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
public static final String CATEGORY_ALARM = "alarm"
Notification category: alarm or timer.
CATEGORY_CALL
public static final String CATEGORY_CALL = "call"
Notification category: incoming call (voice or video) or similar synchronous communication request.
CATEGORY_EMAIL
public static final String CATEGORY_EMAIL = "email"
Notification category: asynchronous bulk message (email).
CATEGORY_ERROR
public static final String CATEGORY_ERROR = "err"
Notification category: error in background operation or authentication status.
CATEGORY_EVENT
public static final String CATEGORY_EVENT = "event"
Notification category: calendar event.
CATEGORY_LOCATION_SHARING
public static final String CATEGORY_LOCATION_SHARING = "location_sharing"
Notification category: temporarily sharing location.
CATEGORY_MESSAGE
public static final String CATEGORY_MESSAGE = "msg"
Notification category: incoming direct message (SMS, instant message, etc.).
CATEGORY_MISSED_CALL
public static final String CATEGORY_MISSED_CALL = "missed_call"
Notification category: missed call.
CATEGORY_NAVIGATION
public static final String CATEGORY_NAVIGATION = "navigation"
Notification category: map turn-by-turn navigation.
CATEGORY_PROGRESS
public static final String CATEGORY_PROGRESS = "progress"
Notification category: progress of a long-running background operation.
CATEGORY_PROMO
public static final String CATEGORY_PROMO = "promo"
Notification category: promotion or advertisement.
CATEGORY_RECOMMENDATION
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
public static final String CATEGORY_REMINDER = "reminder"
Notification category: user-scheduled reminder.
CATEGORY_SERVICE
public static final String CATEGORY_SERVICE = "service"
Notification category: indication of running background service.
CATEGORY_SOCIAL
public static final String CATEGORY_SOCIAL = "social"
Notification category: social network or sharing update.
CATEGORY_STATUS
public static final String CATEGORY_STATUS = "status"
Notification category: ongoing information about device or contextual status.
CATEGORY_STOPWATCH
public static final String CATEGORY_STOPWATCH = "stopwatch"
Notification category: running stopwatch.
CATEGORY_SYSTEM
public static final String CATEGORY_SYSTEM = "sys"
Notification category: system or device status update. Reserved for system use.
CATEGORY_TRANSPORT
public static final String CATEGORY_TRANSPORT = "transport"
Notification category: media transport control for playback.
CATEGORY_VOICEMAIL
public static final String CATEGORY_VOICEMAIL = "voicemail"
Notification category: voicemail.
CATEGORY_WORKOUT
public static final String CATEGORY_WORKOUT = "workout"
Notification category: tracking a user's workout.
COLOR_DEFAULT
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
public static final int DEFAULT_ALL = -1
Use all default values (where applicable).
DEFAULT_LIGHTS
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
public static final String EXTRA_COLORIZED = "android.colorized"
extras key: whether the notification should be colorized as supplied to setColorized.
EXTRA_COMPACT_ACTIONS
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
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
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
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
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
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
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
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
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
public static final String EXTRA_IS_GROUP_CONVERSATION = "android.isGroupConversation"
extras key: whether the NotificationCompat.MessagingStyle notification represents a group conversation.
EXTRA_LARGE_ICON
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
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
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
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
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
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
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.
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
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
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
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
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
public static final String EXTRA_PROGRESS = "android.progress"
extras key: this is the progress value supplied to setProgress.
EXTRA_PROGRESS_END_ICON
public static final String EXTRA_PROGRESS_END_ICON = "android.progressEndIcon"
extras key: this is an IconCompat of an image to be shown at the end of the progress bar in ProgressStyle, supplied to setProgressEndIcon.
EXTRA_PROGRESS_INDETERMINATE
public static final String EXTRA_PROGRESS_INDETERMINATE = "android.progressIndeterminate"
extras key: whether the progress bar is indeterminate, supplied to setProgress.
EXTRA_PROGRESS_MAX
public static final String EXTRA_PROGRESS_MAX = "android.progressMax"
extras key: this is the maximum value supplied to setProgress.
EXTRA_PROGRESS_POINTS
public static final String EXTRA_PROGRESS_POINTS = "android.progressPoints"
extras key: an arraylist of ProgressStyle.Point bundles provided by a android.app.Notification.ProgressStyle notification as supplied to setProgressPoints or addProgressPoint. This extra is a parcelable array list of bundles.
EXTRA_PROGRESS_SEGMENTS
public static final String EXTRA_PROGRESS_SEGMENTS = "android.progressSegments"
extras key: an arraylist of android.app.Notification.ProgressStyle.Segment bundles provided by a android.app.Notification.ProgressStyle notification as supplied to setProgressSegments or addProgressSegment. This extra is a parcelable array list of bundles.
EXTRA_PROGRESS_START_ICON
public static final String EXTRA_PROGRESS_START_ICON = "android.progressStartIcon"
extras key: this is an IconCompat of an image to be shown at the beginning of the progress bar in ProgressStyle, supplied to setProgressStartIcon.
EXTRA_PROGRESS_TRACKER_ICON
public static final String EXTRA_PROGRESS_TRACKER_ICON = "android.progressTrackerIcon"
extras key: this is an IconCompat of an image to be shown as progress bar progress tracker icon in ProgressStyle, supplied to setProgressTrackerIcon.
EXTRA_REMOTE_INPUT_HISTORY
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.
| See also | |
|---|---|
setRemoteInputHistory |
EXTRA_REQUEST_PROMOTED_ONGOING
public static final String EXTRA_REQUEST_PROMOTED_ONGOING = "android.requestPromotedOngoing"
extras key: If provided, should contain a boolean indicating whether the notification is requesting promoted treatment.
EXTRA_SELF_DISPLAY_NAME
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_SHORT_CRITICAL_TEXT
public static final String EXTRA_SHORT_CRITICAL_TEXT = "android.shortCriticalText"
extras key: very short text summarizing the most critical information contained in the notification.
EXTRA_SHOW_BIG_PICTURE_WHEN_COLLAPSED
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
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
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
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_STYLED_BY_PROGRESS
public static final String EXTRA_STYLED_BY_PROGRESS = "android.styledByProgress"
extras key: whether the progress bar should be styled by its progress as supplied to setStyledByProgress. This extra is a boolean.
EXTRA_SUB_TEXT
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
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
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
public static final String EXTRA_TEXT = "android.text"
extras key: this is the main text payload, as supplied to setContentText.
EXTRA_TEXT_LINES
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
public static final String EXTRA_TITLE = "android.title"
extras key: this is the title of the notification, as supplied to setContentTitle.
EXTRA_TITLE_BIG
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
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
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
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
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
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
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
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.
public static final int FLAG_HIGH_PRIORITY = 128
Obsolete flag indicating high-priority notifications; use the priority field instead.
FLAG_INSISTENT
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Public methods
getAction
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
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
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
public static boolean getAutoCancel(@NonNull Notification notification)
Get the value provided to setAutoCancel
getBadgeIconType
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
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
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
public static @Nullable String getChannelId(@NonNull Notification notification)
getColor
public static int getColor(@NonNull Notification notification)
Get the value provided to setColor
getContentInfo
public static @Nullable CharSequence getContentInfo(@NonNull Notification notification)
Returns the content info provided to setContentInfo.
getContentText
public static @Nullable CharSequence getContentText(@NonNull Notification notification)
Returns the content text provided to setContentText.
getContentTitle
public static @Nullable CharSequence getContentTitle(@NonNull Notification notification)
Returns the content title provided to setContentTitle.
@ReplaceWith(expression = "notification.extras")
public static @Nullable BundlegetExtras(@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
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
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
@RequiresApi(value = 21)
public static @NonNull List<NotificationCompat.Action> getInvisibleActions(@NonNull Notification notification)
Returns the invisible actions contained within the given notification.
getLocalOnly
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
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
public static boolean getOngoing(@NonNull Notification notification)
Get the value provided to setOngoing
getOnlyAlertOnce
public static boolean getOnlyAlertOnce(@NonNull Notification notification)
Get the value provided to setOnlyAlertOnce
getPeople
public static @NonNull List<Person> getPeople(@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
public static @Nullable Notification getPublicVersion(@NonNull Notification notification)
Get the value provided to setVisibility
getSettingsText
public static @Nullable CharSequence getSettingsText(@NonNull Notification notification)
Returns the settings text provided to setSettingsText.
getShortCriticalText
public static @Nullable String getShortCriticalText(@NonNull Notification notification)
Returns the very short text summarizing the most critical information contained in the notification, or null if this field was not set.
getShortcutId
public static @Nullable String getShortcutId(@NonNull Notification notification)
Returns the id that this notification supersedes, if any.
getShowWhen
public static boolean getShowWhen(@NonNull Notification notification)
Get the value provided to setShowWhen
getSortKey
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
public static @Nullable CharSequence getSubText(@NonNull Notification notification)
Returns the sub text provided to setSubText.
getTimeoutAfter
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
public static boolean getUsesChronometer(@NonNull Notification notification)
Get the value provided to setUsesChronometer
getVisibility
public static int getVisibility(@NonNull Notification notification)
Get the value provided to setVisibility
hasPromotableCharacteristics
public static boolean hasPromotableCharacteristics(@NonNull Notification notification)
Returns whether the notification has any promotable characteristics.
This is a wrapper around hasPromotableCharacteristics.
isGroupSummary
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. |
isRequestPromotedOngoing
public static boolean isRequestPromotedOngoing(@NonNull Notification notification)
Returns whether this notification has requested to be a promoted ongoing notification.
reduceLargeIconSize
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.