java.lang.Object | |
↳ | android.app.Notification |
A class that represents how a persistent notification is to be presented to
the user using the NotificationManager
.
The Notification.Builder
has been added to make it
easier to construct Notifications.
For a guide to creating notifications, read the Status Bar Notifications developer guide.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Notification.Action | Structure to encapsulate a named action that can be shown as part of this notification. | ||||||||||
Notification.BigPictureStyle | Helper class for generating large-format notifications that include a large image attachment. | ||||||||||
Notification.BigTextStyle | Helper class for generating large-format notifications that include a lot of text. | ||||||||||
Notification.Builder |
Builder class for Notification objects.
|
||||||||||
Notification.Extender |
Extender interface for use with extend(Notification.Action.Extender) .
|
||||||||||
Notification.InboxStyle | Helper class for generating large-format notifications that include a list of (up to 5) strings. | ||||||||||
Notification.MediaStyle | Notification style for media playback notifications. | ||||||||||
Notification.Style |
An object that can apply a rich notification style to a Notification.Builder
object.
|
||||||||||
Notification.WearableExtender | Helper class to add wearable extensions to notifications. |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | CATEGORY_ALARM | Notification category: alarm or timer. | |||||||||
String | CATEGORY_CALL | Notification category: incoming call (voice or video) or similar synchronous communication request. | |||||||||
String | CATEGORY_EMAIL | Notification category: asynchronous bulk message (email). | |||||||||
String | CATEGORY_ERROR | Notification category: error in background operation or authentication status. | |||||||||
String | CATEGORY_EVENT | Notification category: calendar event. | |||||||||
String | CATEGORY_MESSAGE | Notification category: incoming direct message (SMS, instant message, etc.). | |||||||||
String | CATEGORY_PROGRESS | Notification category: progress of a long-running background operation. | |||||||||
String | CATEGORY_PROMO | Notification category: promotion or advertisement. | |||||||||
String | CATEGORY_RECOMMENDATION | Notification category: a specific, timely recommendation for a single thing. | |||||||||
String | CATEGORY_SERVICE | Notification category: indication of running background service. | |||||||||
String | CATEGORY_SOCIAL | Notification category: social network or sharing update. | |||||||||
String | CATEGORY_STATUS | Notification category: ongoing information about device or contextual status. | |||||||||
String | CATEGORY_SYSTEM | Notification category: system or device status update. | |||||||||
String | CATEGORY_TRANSPORT | Notification category: media transport control for playback. | |||||||||
int | COLOR_DEFAULT |
Special value of color 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_BACKGROUND_IMAGE_URI |
extras key: A
content URI pointing to an image that can be displayed
in the background when the notification is selected.
|
|||||||||
String | EXTRA_BIG_TEXT |
extras key: this is the longer text shown in the big form of a
Notification.BigTextStyle notification, as supplied to
bigText(CharSequence) .
|
|||||||||
String | EXTRA_COMPACT_ACTIONS |
extras key: the indices of actions to be shown in the compact view,
as supplied to (e.g.) setShowActionsInCompactView(int) .
|
|||||||||
String | EXTRA_INFO_TEXT |
extras key: this is a small piece of additional text as supplied to
setContentInfo(CharSequence) .
|
|||||||||
String | EXTRA_LARGE_ICON |
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 |
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_MEDIA_SESSION |
extras key: A
MediaSession.Token associated with a
Notification.MediaStyle notification.
|
|||||||||
String | EXTRA_PEOPLE |
extras key: A String array containing the people that this notification relates to,
each of which was supplied to addPerson(String) .
|
|||||||||
String | EXTRA_PICTURE |
extras key: this is a bitmap to be shown in Notification.BigPictureStyle expanded
notifications, supplied to bigPicture(android.graphics.Bitmap) .
|
|||||||||
String | EXTRA_PROGRESS |
extras key: this is the progress value supplied to
setProgress(int, int, boolean) .
|
|||||||||
String | EXTRA_PROGRESS_INDETERMINATE |
extras key: whether the progress bar is indeterminate, supplied to
setProgress(int, int, boolean) .
|
|||||||||
String | EXTRA_PROGRESS_MAX |
extras key: this is the maximum value supplied to
setProgress(int, int, boolean) .
|
|||||||||
String | EXTRA_SHOW_CHRONOMETER |
extras key: whether when should be shown as a count-up timer (specifically
a Chronometer ) instead of a timestamp, as supplied to
setUsesChronometer(boolean) .
|
|||||||||
String | EXTRA_SHOW_WHEN |
extras key: whether when should be shown,
as supplied to setShowWhen(boolean) .
|
|||||||||
String | EXTRA_SMALL_ICON |
extras key: this is the resource ID of the notification's main small icon, as
supplied to setSmallIcon(int) .
|
|||||||||
String | EXTRA_SUB_TEXT |
extras key: this is a third line of text, as supplied to
setSubText(CharSequence) .
|
|||||||||
String | EXTRA_SUMMARY_TEXT |
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_TEMPLATE |
extras key: A string representing the name of the specific
Notification.Style used to create this notification.
|
|||||||||
String | EXTRA_TEXT |
extras key: this is the main text payload, as supplied to
setContentText(CharSequence) .
|
|||||||||
String | EXTRA_TEXT_LINES |
extras key: An array of CharSequences to show in Notification.InboxStyle expanded
notifications, each of which was supplied to addLine(CharSequence) .
|
|||||||||
String | EXTRA_TITLE |
extras key: this is the title of the notification,
as supplied to setContentTitle(CharSequence) .
|
|||||||||
String | EXTRA_TITLE_BIG |
extras key: this is the title of the notification when shown in expanded form,
e.g.
|
|||||||||
int | FLAG_AUTO_CANCEL |
Bit to be bitwise-ored into the flags field that should be
set if the notification should be canceled when it is clicked by the
user.
|
|||||||||
int | FLAG_FOREGROUND_SERVICE |
Bit to be bitwise-ored into the flags field that should be
set if this notification represents a currently running service.
|
|||||||||
int | FLAG_GROUP_SUMMARY |
Bit to be bitswise-ored into the flags field that should be
set if this notification is the group summary for a group of notifications.
|
|||||||||
int | FLAG_HIGH_PRIORITY |
This constant was deprecated
in API level 16.
Use priority with a positive value.
|
|||||||||
int | FLAG_INSISTENT |
Bit to be bitwise-ored into the flags field that if set,
the audio will be repeated until the notification is
cancelled or the notification window is opened.
|
|||||||||
int | FLAG_LOCAL_ONLY |
Bit to be bitswise-ored into the flags field that should be
set 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 to be bitwise-ored into the flags field that should be
set if the notification should not be canceled when the user clicks
the Clear all button.
|
|||||||||
int | FLAG_ONGOING_EVENT |
Bit to be bitwise-ored into the flags field that should be
set if this notification is in reference to something that is ongoing,
like a phone call.
|
|||||||||
int | FLAG_ONLY_ALERT_ONCE |
Bit to be bitwise-ored into the flags field that should be
set if you would only like the sound, vibrate and ticker to be played
if the notification was not already showing.
|
|||||||||
int | FLAG_SHOW_LIGHTS |
Bit to be bitwise-ored into the flags field that should be
set if you want the LED on for this notification.
|
|||||||||
String | INTENT_CATEGORY_NOTIFICATION_PREFERENCES | An activity that provides a user interface for adjusting notification preferences for its containing application. | |||||||||
int | PRIORITY_DEFAULT |
Default notification priority .
|
|||||||||
int | PRIORITY_HIGH |
Higher priority , for more important notifications or alerts.
|
|||||||||
int | PRIORITY_LOW |
Lower priority , for items that are less important.
|
|||||||||
int | PRIORITY_MAX |
Highest priority , for your application's most important items that require the
user's prompt attention or input.
|
|||||||||
int | PRIORITY_MIN |
Lowest priority ; these items might not be shown to the user except under special
circumstances, such as detailed notification logs.
|
|||||||||
int | STREAM_DEFAULT |
This constant was deprecated
in API level 21.
Use audioAttributes instead.
|
|||||||||
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. |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
android.os.Parcelable
|
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
AUDIO_ATTRIBUTES_DEFAULT |
The default value of audioAttributes .
|
||||||||||
CREATOR | Parcelable.Creator that instantiates Notification objects | ||||||||||
actions |
Array of all Notification.Action structures attached to this notification by
addAction(int, CharSequence, PendingIntent) .
|
||||||||||
audioAttributes |
The audio attributes to use when playing the sound.
|
||||||||||
audioStreamType |
This field was deprecated
in API level 21.
Use audioAttributes instead.
|
||||||||||
bigContentView |
A large-format version of contentView , giving the Notification an
opportunity to show more detail.
|
||||||||||
category |
One of the predefined notification categories (see the CATEGORY_* constants)
that best describes this Notification.
|
||||||||||
color |
Accent color (an ARGB integer like the constants in Color )
to be applied by the standard Style templates when presenting this notification.
|
||||||||||
contentIntent | The intent to execute when the expanded status entry is clicked. | ||||||||||
contentView | The view that will represent this notification in the expanded status bar. | ||||||||||
defaults | Specifies which values should be taken from the defaults. | ||||||||||
deleteIntent | The intent to execute when the notification is explicitly dismissed by the user, either with the "Clear All" button or by swiping it away individually. | ||||||||||
extras | Additional semantic data to be carried around with this Notification. | ||||||||||
flags | |||||||||||
fullScreenIntent | An intent to launch instead of posting the notification to the status bar. | ||||||||||
headsUpContentView |
A medium-format version of contentView , providing the Notification an
opportunity to add action buttons to contentView.
|
||||||||||
icon | The resource id of a drawable to use as the icon in the status bar. | ||||||||||
iconLevel | If the icon in the status bar is to have more than one level, you can set this. | ||||||||||
largeIcon | The bitmap that may escape the bounds of the panel and bar. | ||||||||||
ledARGB | The color of the led. | ||||||||||
ledOffMS | The number of milliseconds for the LED to be off while it's flashing. | ||||||||||
ledOnMS | The number of milliseconds for the LED to be on while it's flashing. | ||||||||||
number | The number of events that this notification represents. | ||||||||||
priority | Relative priority for this notification. | ||||||||||
publicVersion | Replacement version of this notification whose content will be shown in an insecure context such as atop a secure keyguard. | ||||||||||
sound | The sound to play. | ||||||||||
tickerText | Text that summarizes this notification for accessibility services. | ||||||||||
tickerView |
Formerly, a view showing the tickerText .
|
||||||||||
vibrate | The pattern with which to vibrate. | ||||||||||
visibility | Sphere of visibility of this notification, which affects how and when the SystemUI reveals the notification's presence and contents in untrusted situations (namely, on the secure lockscreen). | ||||||||||
when | A timestamp related to this notification, in milliseconds since the epoch. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a Notification object with default values.
| |||||||||||
This constructor was deprecated
in API level 11.
Use
Notification.Builder instead.
| |||||||||||
Unflatten the notification from a parcel.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates and returns a copy of this
Object .
| |||||||||||
Describe the kinds of special objects contained in this Parcelable's
marshalled representation.
| |||||||||||
Get the key used to group this notification into a cluster or stack
with other notifications on devices which support such rendering.
| |||||||||||
Get a sort key that orders this notification among other notifications from the
same package.
| |||||||||||
This method was deprecated
in API level 11.
Use
Notification.Builder instead.
| |||||||||||
Returns a string containing a concise, human-readable description of this
object.
| |||||||||||
Flatten this notification from a parcel.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
android.os.Parcelable
|
Notification category: alarm or timer.
Notification category: incoming call (voice or video) or similar synchronous communication request.
Notification category: asynchronous bulk message (email).
Notification category: error in background operation or authentication status.
Notification category: calendar event.
Notification category: incoming direct message (SMS, instant message, etc.).
Notification category: progress of a long-running background operation.
Notification category: promotion or advertisement.
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.
Notification category: indication of running background service.
Notification category: social network or sharing update.
Notification category: ongoing information about device or contextual status.
Notification category: system or device status update. Reserved for system use.
Notification category: media transport control for playback.
Special value of color
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 ledARGB
, ledOffMS
, or
ledOnMS
.
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.
extras
key: this is the longer text shown in the big form of a
Notification.BigTextStyle
notification, as supplied to
bigText(CharSequence)
.
extras
key: the indices of actions to be shown in the compact view,
as supplied to (e.g.) setShowActionsInCompactView(int)
.
extras
key: this is a small piece of additional text as supplied to
setContentInfo(CharSequence)
.
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)
.
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)
.
extras
key: A
MediaSession.Token
associated with a
Notification.MediaStyle
notification.
extras
key: A String array containing the people that this notification relates to,
each of which was supplied to addPerson(String)
.
extras
key: this is a bitmap to be shown in Notification.BigPictureStyle
expanded
notifications, supplied to bigPicture(android.graphics.Bitmap)
.
extras
key: this is the progress value supplied to
setProgress(int, int, boolean)
.
extras
key: whether the progress bar is indeterminate, supplied to
setProgress(int, int, boolean)
.
extras
key: this is the maximum value supplied to
setProgress(int, int, boolean)
.
extras
key: whether when
should be shown as a count-up timer (specifically
a Chronometer
) instead of a timestamp, as supplied to
setUsesChronometer(boolean)
.
extras
key: whether when
should be shown,
as supplied to setShowWhen(boolean)
.
extras
key: this is the resource ID of the notification's main small icon, as
supplied to setSmallIcon(int)
.
extras
key: this is a third line of text, as supplied to
setSubText(CharSequence)
.
extras
key: this is a line of summary information intended to be shown
alongside expanded notifications, as supplied to (e.g.)
setSummaryText(CharSequence)
.
extras
key: A string representing the name of the specific
Notification.Style
used to create this notification.
extras
key: this is the main text payload, as supplied to
setContentText(CharSequence)
.
extras
key: An array of CharSequences to show in Notification.InboxStyle
expanded
notifications, each of which was supplied to addLine(CharSequence)
.
extras
key: this is the title of the notification,
as supplied to setContentTitle(CharSequence)
.
extras
key: this is the title of the notification when shown in expanded form,
e.g. as supplied to setBigContentTitle(CharSequence)
.
Bit to be bitwise-ored into the flags
field that should be
set if the notification should be canceled when it is clicked by the
user.
Bit to be bitwise-ored into the flags
field that should be
set if this notification represents a currently running service. This
will normally be set for you by startForeground(int, Notification)
.
Bit to be bitswise-ored into the flags
field that should be
set 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 was deprecated
in API level 16.
Use priority
with a positive value.
Obsolete flag indicating high-priority notifications; use the priority field instead.
Bit to be bitwise-ored into the flags
field that if set,
the audio will be repeated until the notification is
cancelled or the notification window is opened.
Bit to be bitswise-ored into the flags
field that should be
set if this notification is relevant to the current device only
and it is not recommended that it bridge to other devices.
Bit to be bitwise-ored into the flags
field that should be
set if the notification should not be canceled when the user clicks
the Clear all button.
Bit to be bitwise-ored into the flags
field that should be
set 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 to be bitwise-ored into the flags
field that should be
set if you would only like the sound, vibrate and ticker to be played
if the notification was not already showing.
Bit to be bitwise-ored into the flags
field that should be
set if you want the LED on for this notification.
Since hardware varies, you are not guaranteed that any of the values you pass are honored exactly. Use the system defaults (TODO) if possible because they will be set to values that work on any given hardware.
The alpha channel must be set for forward compatibility.
An activity that provides a user interface for adjusting notification preferences for its
containing application. Optional but recommended for apps that post
Notifications
.
Default notification priority
. If your application does not prioritize its own
notifications, use this value for all notifications.
Higher priority
, 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 priority
, 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 priority
, for your application's most important items that require the
user's prompt attention or input.
Lowest priority
; these items might not be shown to the user except under special
circumstances, such as detailed notification logs.
This constant was deprecated
in API level 21.
Use audioAttributes
instead.
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.
The default value of audioAttributes
.
Parcelable.Creator that instantiates Notification objects
Array of all Notification.Action
structures attached to this notification by
addAction(int, CharSequence, PendingIntent)
. Mostly useful for instances of
NotificationListenerService
that provide an alternative
interface for invoking actions.
The audio attributes
to use when playing the sound.
This field was deprecated
in API level 21.
Use audioAttributes
instead.
The audio stream type to use when playing the sound.
Should be one of the STREAM_ constants from
AudioManager
.
A large-format version of contentView
, giving the Notification an
opportunity to show more detail. The system UI may choose to show this
instead of the normal content view at its discretion.
One of the predefined notification categories (see the CATEGORY_*
constants)
that best describes this Notification. May be used by the system for ranking and filtering.
Accent color (an ARGB integer like the constants in Color
)
to be applied by the standard Style templates when presenting this notification.
The current template design constructs a colorful header image by overlaying the
icon
image (stenciled in white) atop a field of this color. Alpha components are
ignored.
The intent to execute when the expanded status entry is clicked. If
this is an activity, it must include the
FLAG_ACTIVITY_NEW_TASK
flag, which requires
that you take care of task management as described in the
Tasks and Back
Stack document. In particular, make sure to read the notification section
Handling
Notifications for the correct ways to launch an application from a
notification.
The view that will represent this notification in the expanded status bar.
Specifies which values should be taken from the defaults.
To set, OR the desired from DEFAULT_SOUND
,
DEFAULT_VIBRATE
, DEFAULT_LIGHTS
. For all default
values, use DEFAULT_ALL
.
The intent to execute when the notification is explicitly dismissed by the user, either with the "Clear All" button or by swiping it away individually. This probably shouldn't be launching an activity since several of those will be sent at the same time.
Additional semantic data to be carried around with this Notification.
The extras keys defined here are intended to capture the original inputs to Notification.Builder
APIs, and are intended to be used by
NotificationListenerService
implementations to extract
detailed information from notification objects.
An intent to launch instead of posting the notification to the status bar.
The system UI may choose to display a heads-up notification, instead of launching this intent, while the user is using the device.
A medium-format version of contentView
, providing the Notification an
opportunity to add action buttons to contentView. At its discretion, the system UI may
choose to show this as a heads-up notification, which will pop up so the user can see
it without leaving their current activity.
The resource id of a drawable to use as the icon in the status bar. This is required; notifications with an invalid icon resource will not be shown.
If the icon in the status bar is to have more than one level, you can set this. Otherwise, leave it at its default value of 0.
The bitmap that may escape the bounds of the panel and bar.
The color of the led. The hardware will do its best approximation.
The number of milliseconds for the LED to be off while it's flashing. The hardware will do its best approximation.
The number of milliseconds for the LED to be on while it's flashing. The hardware will do its best approximation.
The number of events that this notification represents. For example, in a new mail
notification, this could be the number of unread messages.
The system may or may not use this field to modify the appearance of the notification. For
example, before HONEYCOMB
, this number was
superimposed over the icon in the status bar. Starting with
HONEYCOMB
, the template used by
Notification.Builder
has displayed the number in the expanded notification view.
If the number is 0 or negative, it is never shown.
Relative priority for this notification. Priority is an indication of how much of the user's valuable attention should be consumed by this notification. Low-priority notifications may be hidden from the user in certain situations, while the user might be interrupted for a higher-priority notification. The system will make a determination about how to interpret this priority when presenting the notification.
A notification that is at least PRIORITY_HIGH
is more likely to be presented
as a heads-up notification.
Replacement version of this notification whose content will be shown
in an insecure context such as atop a secure keyguard. See visibility
and VISIBILITY_PUBLIC
.
The sound to play.
A notification that is noisy is more likely to be presented as a heads-up notification.
To play the default notification sound, see defaults
.
Text that summarizes this notification for accessibility services. As of the L release, this text is no longer shown on screen, but it is still useful to accessibility services (where it serves as an audible announcement of the notification's appearance).
Formerly, a view showing the tickerText
.
No longer displayed in the status bar as of API 21.
The pattern with which to vibrate.
To vibrate the default pattern, see defaults
.
A notification that vibrates is more likely to be presented as a heads-up notification.
Sphere of visibility of this notification, which affects how and when the SystemUI reveals
the notification's presence and contents in untrusted situations (namely, on the secure
lockscreen).
The default level, VISIBILITY_PRIVATE
, behaves exactly as notifications have always
done on Android: The notification's icon
and tickerText
(if available) are
shown in all situations, but the contents are only available if the device is unlocked for
the appropriate user.
A more permissive policy can be expressed by VISIBILITY_PUBLIC
; such a notification
can be read even in an "insecure" context (that is, above a secure lockscreen).
To modify the public version of this notification—for example, to redact some portions—see
setPublicVersion(Notification)
.
Finally, a notification can be made VISIBILITY_SECRET
, which will suppress its icon
and ticker until the user has bypassed the lockscreen.
A timestamp related to this notification, in milliseconds since the epoch.
Default value: Now
.
Choose a timestamp that will be most relevant to the user. For most finite events, this
corresponds to the time the event happened (or will happen, in the case of events that have
yet to occur but about which the user is being informed). Indefinite events should be
timestamped according to when the activity began.
Some examples:
Constructs a Notification object with default values.
You might want to consider using Notification.Builder
instead.
This constructor was deprecated
in API level 11.
Use Notification.Builder
instead.
Constructs a Notification object with the information needed to have a status bar icon without the standard expanded view.
icon | The resource id of the icon to put in the status bar. |
---|---|
tickerText | The text that flows by in the status bar when the notification first activates. |
when | The time to show in the time field. In the System.currentTimeMillis timebase. |
Creates and returns a copy of this Object
. The default
implementation returns a so-called "shallow" copy: It creates a new
instance of the same class and then copies the field values (including
object references) from this instance to the new instance. A "deep" copy,
in contrast, would also recursively clone nested objects. A subclass that
needs to implement this kind of cloning should call super.clone()
to create the new instance and then create deep copies of the nested,
mutable objects.
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
Get the key used to group this notification into a cluster or stack with other notifications on devices which support such rendering.
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)
.
This method was deprecated
in API level 11.
Use Notification.Builder
instead.
Sets the contentView
field to be a view with the standard "Latest Event"
layout.
Uses the icon
and when
fields to set the icon and time fields
in the view.
context | The context for your application / activity. |
---|---|
contentTitle | The title that goes in the expanded entry. |
contentText | The text that goes in the expanded entry. |
contentIntent | The intent to launch when the user clicks the expanded notification.
If this is an activity, it must include the
FLAG_ACTIVITY_NEW_TASK flag, which requires
that you take care of task management as described in the
Tasks and Back
Stack document. |
Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:
getClass().getName() + '@' + Integer.toHexString(hashCode())
See Writing a useful
toString
method
if you intend implementing your own toString
method.
Flatten this notification from a parcel.
parcel | The Parcel in which the object should be written. |
---|---|
flags | Additional flags about how the object should be written.
May be 0 or PARCELABLE_WRITE_RETURN_VALUE .
|