java.lang.Object | |
↳ | android.support.v4.app.NotificationCompat |
Helper for accessing features in Notification
introduced after API level 4 in a backwards compatible fashion.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
NotificationCompat.Action | Structure to encapsulate a named action that can be shown as part of this notification. | ||||||||||
NotificationCompat.BigPictureStyle | Helper class for generating large-format notifications that include a large image attachment. | ||||||||||
NotificationCompat.BigTextStyle | Helper class for generating large-format notifications that include a lot of text. | ||||||||||
NotificationCompat.Builder | Builder class for NotificationCompat objects. |
||||||||||
NotificationCompat.Extender | Extender interface for use with extend(NotificationCompat.Extender) . |
||||||||||
NotificationCompat.InboxStyle | Helper class for generating large-format notifications that include a list of (up to 5) strings. | ||||||||||
NotificationCompat.Style | An object that can apply a rich notification style to a Notification.Action.Builder
object. |
||||||||||
NotificationCompat.WearableExtender | Helper class to add wearable extensions to notifications. |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | COLOR_DEFAULT | 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. |
|||||||||
int | DEFAULT_ALL | Use all default values (where applicable). | |||||||||
int | DEFAULT_LIGHTS | Use the default notification lights. | |||||||||
int | DEFAULT_SOUND | Use the default notification sound. | |||||||||
int | DEFAULT_VIBRATE | Use the default notification vibrate. | |||||||||
String | EXTRA_INFO_TEXT | Notification extras key: this is a small piece of additional text as supplied to
setContentInfo(CharSequence) . |
|||||||||
String | EXTRA_LARGE_ICON | Notification extras key: this is a bitmap to be used instead of the small icon when showing the
notification payload, as
supplied to setLargeIcon(android.graphics.Bitmap) . |
|||||||||
String | EXTRA_LARGE_ICON_BIG | Notification extras key: this is a bitmap to be used instead of the one from
setLargeIcon(android.graphics.Bitmap) when the notification is
shown in its expanded form, as supplied to
bigLargeIcon(android.graphics.Bitmap) . |
|||||||||
String | EXTRA_PEOPLE | Notification extras key: An array of people that this notification relates to, specified by contacts provider contact URI. | |||||||||
String | EXTRA_PICTURE | Notification extras key: this is a bitmap to be shown in NotificationCompat.BigPictureStyle expanded
notifications, supplied to bigPicture(android.graphics.Bitmap) . |
|||||||||
String | EXTRA_PROGRESS | Notification extras key: this is the progress value supplied to
setProgress(int, int, boolean) . |
|||||||||
String | EXTRA_PROGRESS_INDETERMINATE | Notification extras key: whether the progress bar is indeterminate, supplied to
setProgress(int, int, boolean) . |
|||||||||
String | EXTRA_PROGRESS_MAX | Notification extras key: this is the maximum value supplied to
setProgress(int, int, boolean) . |
|||||||||
String | EXTRA_SHOW_CHRONOMETER | Notification extras key: whether the when field set using setWhen(long) should
be shown as a count-up timer (specifically a Chronometer ) instead
of a timestamp, as supplied to setUsesChronometer(boolean) . |
|||||||||
String | EXTRA_SMALL_ICON | Notification extras key: this is the resource ID of the notification's main small icon, as
supplied to setSmallIcon(int) . |
|||||||||
String | EXTRA_SUB_TEXT | Notification extras key: this is a third line of text, as supplied to
setSubText(CharSequence) . |
|||||||||
String | EXTRA_SUMMARY_TEXT | Notification extras key: this is a line of summary information intended to be shown
alongside expanded notifications, as supplied to (e.g.)
setSummaryText(CharSequence) . |
|||||||||
String | EXTRA_TEXT | Notification extras key: this is the main text payload, as supplied to
setContentText(CharSequence) . |
|||||||||
String | EXTRA_TEXT_LINES | Notification extras key: An array of CharSequences to show in NotificationCompat.InboxStyle expanded
notifications, each of which was supplied to addLine(CharSequence) . |
|||||||||
String | EXTRA_TITLE | Notification extras key: this is the title of the notification,
as supplied to setContentTitle(CharSequence) . |
|||||||||
String | EXTRA_TITLE_BIG | Notification extras key: this is the title of the notification when shown in expanded form, e.g. | |||||||||
int | FLAG_AUTO_CANCEL | Bit set in the Notification flags field if the notification should be canceled when it is clicked by the user. | |||||||||
int | FLAG_FOREGROUND_SERVICE | Bit set in the Notification flags field if this notification represents a currently running service. | |||||||||
int | FLAG_GROUP_SUMMARY | Bit set in the Notification flags field if this notification is the group summary for a group of notifications. | |||||||||
int | FLAG_HIGH_PRIORITY |
This constant is deprecated.
Use setPriority(int) with a positive value.
|
|||||||||
int | FLAG_INSISTENT | Bit set in the Notification flags field if the audio will be repeated until the notification is cancelled or the notification window is opened. | |||||||||
int | FLAG_LOCAL_ONLY | 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. | |||||||||
int | FLAG_NO_CLEAR | Bit set in the Notification flags field if the notification should not be canceled when the user clicks the Clear all button. | |||||||||
int | FLAG_ONGOING_EVENT | Bit set in the Notification flags field if this notification is in reference to something that is ongoing, like a phone call. | |||||||||
int | FLAG_ONLY_ALERT_ONCE | 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. | |||||||||
int | FLAG_SHOW_LIGHTS | Bit set in the Notification flags field when LEDs should be turned on for this notification. | |||||||||
int | PRIORITY_DEFAULT | Default notification priority for setPriority(int) . |
|||||||||
int | PRIORITY_HIGH | Higher notification priority for setPriority(int) ,
for more important notifications or alerts. |
|||||||||
int | PRIORITY_LOW | Lower notification priority for setPriority(int) ,
for items that are less important. |
|||||||||
int | PRIORITY_MAX | Highest notification priority for setPriority(int) ,
for your application's most important items that require the user's
prompt attention or input. |
|||||||||
int | PRIORITY_MIN | Lowest notification priority for setPriority(int) ;
these items might not be shown to the user except under
special circumstances, such as detailed notification logs. |
|||||||||
int | STREAM_DEFAULT | Use this constant as the value for audioStreamType to request that the default stream type for notifications be used. | |||||||||
int | VISIBILITY_PRIVATE | Notification visibility: Show this notification on all lockscreens, but conceal sensitive or private information on secure lockscreens. | |||||||||
int | VISIBILITY_PUBLIC | Notification visibility: Show this notification in its entirety on all lockscreens. | |||||||||
int | VISIBILITY_SECRET | Notification visibility: Do not reveal any part of this notification on a secure lockscreen. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Get an action on this notification in a backwards compatible
manner.
| |||||||||||
Get the number of actions in this notification in a backwards compatible
manner.
| |||||||||||
Gets the
extras field from a notification in a backwards
compatible manner. | |||||||||||
Get the key used to group this notification into a cluster or stack
with other notifications on devices which support such rendering.
| |||||||||||
Get whether or not this notification is only relevant to the current device.
| |||||||||||
Get a sort key that orders this notification among other notifications from the
same package.
| |||||||||||
Get whether this notification to be the group summary for a group of notifications.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
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.
Use all default values (where applicable).
Use the default notification lights. This will ignore the
FLAG_SHOW_LIGHTS
bit, and values set with setLights(int, int, int)
.
Use the default notification sound. This will ignore any sound set using
setSound(Uri)
Use the default notification vibrate. This will ignore any vibrate set using
setVibrate(long[])
. Using phone vibration requires the
VIBRATE
permission.
Notification extras key: this is a small piece of additional text as supplied to
setContentInfo(CharSequence)
.
Notification extras key: this is a bitmap to be used instead of the small icon when showing the
notification payload, as
supplied to setLargeIcon(android.graphics.Bitmap)
.
Notification extras key: this is a bitmap to be used instead of the one from
setLargeIcon(android.graphics.Bitmap)
when the notification is
shown in its expanded form, as supplied to
bigLargeIcon(android.graphics.Bitmap)
.
Notification extras key: An array of people that this notification relates to, specified by contacts provider contact URI.
Notification extras key: this is a bitmap to be shown in NotificationCompat.BigPictureStyle
expanded
notifications, supplied to bigPicture(android.graphics.Bitmap)
.
Notification extras key: this is the progress value supplied to
setProgress(int, int, boolean)
.
Notification extras key: whether the progress bar is indeterminate, supplied to
setProgress(int, int, boolean)
.
Notification extras key: this is the maximum value supplied to
setProgress(int, int, boolean)
.
Notification extras key: whether the when field set using setWhen(long)
should
be shown as a count-up timer (specifically a Chronometer
) instead
of a timestamp, as supplied to setUsesChronometer(boolean)
.
Notification extras key: this is the resource ID of the notification's main small icon, as
supplied to setSmallIcon(int)
.
Notification extras key: this is a third line of text, as supplied to
setSubText(CharSequence)
.
Notification extras key: this is a line of summary information intended to be shown
alongside expanded notifications, as supplied to (e.g.)
setSummaryText(CharSequence)
.
Notification extras key: this is the main text payload, as supplied to
setContentText(CharSequence)
.
Notification extras key: An array of CharSequences to show in NotificationCompat.InboxStyle
expanded
notifications, each of which was supplied to addLine(CharSequence)
.
Notification extras key: this is the title of the notification,
as supplied to setContentTitle(CharSequence)
.
Notification extras key: this is the title of the notification when shown in expanded form,
e.g. as supplied to setBigContentTitle(CharSequence)
.
Bit set in the Notification flags field if the notification should be canceled when it is clicked by the user.
Bit set in the Notification flags field if this notification represents a currently
running service. This will normally be set for you by
startForeground(int, Notification)
.
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(String)
.
This constant is deprecated.
Use setPriority(int)
with a positive value.
Obsolete flag indicating high-priority notifications; use the priority field instead.
Bit set in the Notification flags field if the audio will be repeated until the notification is cancelled or the notification window is opened.
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.
Bit set in the Notification flags field if the notification should not be canceled when the user clicks the Clear all button.
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.
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.
Bit set in the Notification flags field when LEDs should be turned on for this notification.
Default notification priority for setPriority(int)
.
If your application does not prioritize its own notifications,
use this value for all notifications.
Higher notification priority for setPriority(int)
,
for more important notifications or alerts. The UI may choose
to show these items larger, or at a different position in
notification lists, compared with your app's PRIORITY_DEFAULT
items.
Lower notification priority for setPriority(int)
,
for items that are less important. The UI may choose to show
these items smaller, or at a different position in the list,
compared with your app's PRIORITY_DEFAULT
items.
Highest notification priority for setPriority(int)
,
for your application's most important items that require the user's
prompt attention or input.
Lowest notification priority for setPriority(int)
;
these items might not be shown to the user except under
special circumstances, such as detailed notification logs.
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
.
Notification visibility: Show this notification on all lockscreens, but conceal sensitive or private information on secure lockscreens.
Notification visibility: Show this notification in its entirety on all lockscreens.
Notification visibility: Do not reveal any part of this notification on a secure lockscreen.
Get an action on this notification in a backwards compatible manner. Actions were supported from JellyBean (Api level 16) forwards.
notif | The notification to inspect. |
---|---|
actionIndex | The index of the action to retrieve. |
Get the number of actions in this notification in a backwards compatible manner. Actions were supported from JellyBean (Api level 16) forwards.
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.
Get the key used to group this notification into a cluster or stack with other notifications on devices which support such rendering.
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.
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(String)
.
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(String)
.