Fields Summary |
---|
private static final String | TAG |
public static final String | INTENT_CATEGORY_NOTIFICATION_PREFERENCESAn activity that provides a user interface for adjusting notification preferences for its
containing application. Optional but recommended for apps that post
{@link android.app.Notification Notifications}. |
public static final int | DEFAULT_ALLUse all default values (where applicable). |
public static final int | DEFAULT_SOUNDUse the default notification sound. This will ignore any given
{@link #sound}.
A notification that is noisy is more likely to be presented as a heads-up notification.
|
public static final int | DEFAULT_VIBRATEUse the default notification vibrate. This will ignore any given
{@link #vibrate}. Using phone vibration requires the
{@link android.Manifest.permission#VIBRATE VIBRATE} permission.
A notification that vibrates is more likely to be presented as a heads-up notification.
|
public static final int | DEFAULT_LIGHTSUse the default notification lights. This will ignore the
{@link #FLAG_SHOW_LIGHTS} bit, and {@link #ledARGB}, {@link #ledOffMS}, or
{@link #ledOnMS}. |
private static final int | MAX_CHARSEQUENCE_LENGTHMaximum length of CharSequences accepted by Builder and friends.
Avoids spamming the system with overly large strings such as full e-mails. |
public long | whenA timestamp related to this notification, in milliseconds since the epoch.
Default value: {@link System#currentTimeMillis() 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:
- Notification of a new chat message should be stamped when the message was received.
- Notification of an ongoing file download (with a progress bar, for example) should be stamped when the download started.
- Notification of a completed file download should be stamped when the download finished.
- Notification of an upcoming meeting should be stamped with the time the meeting will begin (that is, in the future).
- Notification of an ongoing stopwatch (increasing timer) should be stamped with the watch's start time.
- Notification of an ongoing countdown timer should be stamped with the timer's end time.
|
public int | iconThe 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. |
public int | iconLevelIf 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. |
public int | numberThe 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 {@link android.os.Build.VERSION_CODES#HONEYCOMB}, this number was
superimposed over the icon in the status bar. Starting with
{@link android.os.Build.VERSION_CODES#HONEYCOMB}, the template used by
{@link Notification.Builder} has displayed the number in the expanded notification view.
If the number is 0 or negative, it is never shown. |
public PendingIntent | contentIntentThe intent to execute when the expanded status entry is clicked. If
this is an activity, it must include the
{@link android.content.Intent#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. |
public PendingIntent | deleteIntentThe 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. |
public PendingIntent | fullScreenIntentAn 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.
|
public CharSequence | tickerTextText 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). |
public android.widget.RemoteViews | tickerViewFormerly, a view showing the {@link #tickerText}.
No longer displayed in the status bar as of API 21. |
public android.widget.RemoteViews | contentViewThe view that will represent this notification in the expanded status bar. |
public android.widget.RemoteViews | bigContentViewA large-format version of {@link #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. |
public android.widget.RemoteViews | headsUpContentViewA medium-format version of {@link #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. |
public android.graphics.Bitmap | largeIconThe bitmap that may escape the bounds of the panel and bar. |
public android.net.Uri | soundThe 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 {@link #defaults}.
|
public static final int | STREAM_DEFAULTUse this constant as the value for audioStreamType to request that
the default stream type for notifications be used. Currently the
default stream type is {@link AudioManager#STREAM_NOTIFICATION}. |
public int | audioStreamTypeThe audio stream type to use when playing the sound.
Should be one of the STREAM_ constants from
{@link android.media.AudioManager}. |
public static final android.media.AudioAttributes | AUDIO_ATTRIBUTES_DEFAULTThe default value of {@link #audioAttributes}. |
public android.media.AudioAttributes | audioAttributesThe {@link AudioAttributes audio attributes} to use when playing the sound. |
public long[] | vibrateThe pattern with which to vibrate.
To vibrate the default pattern, see {@link #defaults}.
A notification that vibrates is more likely to be presented as a heads-up notification.
|
public int | ledARGBThe color of the led. The hardware will do its best approximation. |
public int | ledOnMSThe number of milliseconds for the LED to be on while it's flashing.
The hardware will do its best approximation. |
public int | ledOffMSThe number of milliseconds for the LED to be off while it's flashing.
The hardware will do its best approximation. |
public int | defaultsSpecifies which values should be taken from the defaults.
To set, OR the desired from {@link #DEFAULT_SOUND},
{@link #DEFAULT_VIBRATE}, {@link #DEFAULT_LIGHTS}. For all default
values, use {@link #DEFAULT_ALL}.
|
public static final int | FLAG_SHOW_LIGHTSBit to be bitwise-ored into the {@link #flags} field that should be
set if you want the LED on for this notification.
- To turn the LED off, pass 0 in the alpha channel for colorARGB
or 0 for both ledOnMS and ledOffMS.
- To turn the LED on, pass 1 for ledOnMS and 0 for ledOffMS.
- To flash the LED, pass the number of milliseconds that it should
be on and off to ledOnMS and ledOffMS.
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. |
public static final int | FLAG_ONGOING_EVENTBit to be bitwise-ored into the {@link #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. |
public static final int | FLAG_INSISTENTBit to be bitwise-ored into the {@link #flags} field that if set,
the audio will be repeated until the notification is
cancelled or the notification window is opened. |
public static final int | FLAG_ONLY_ALERT_ONCEBit to be bitwise-ored into the {@link #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. |
public static final int | FLAG_AUTO_CANCELBit to be bitwise-ored into the {@link #flags} field that should be
set if the notification should be canceled when it is clicked by the
user. |
public static final int | FLAG_NO_CLEARBit to be bitwise-ored into the {@link #flags} field that should be
set if the notification should not be canceled when the user clicks
the Clear all button. |
public static final int | FLAG_FOREGROUND_SERVICEBit to be bitwise-ored into the {@link #flags} field that should be
set if this notification represents a currently running service. This
will normally be set for you by {@link Service#startForeground}. |
public static final int | FLAG_HIGH_PRIORITYObsolete flag indicating high-priority notifications; use the priority field instead. |
public static final int | FLAG_LOCAL_ONLYBit to be bitswise-ored into the {@link #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. |
public static final int | FLAG_GROUP_SUMMARYBit to be bitswise-ored into the {@link #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 {@link Builder#setGroup}. |
public int | flags |
public static final int | PRIORITY_DEFAULTDefault notification {@link #priority}. If your application does not prioritize its own
notifications, use this value for all notifications. |
public static final int | PRIORITY_LOWLower {@link #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
{@link #PRIORITY_DEFAULT} items. |
public static final int | PRIORITY_MINLowest {@link #priority}; these items might not be shown to the user except under special
circumstances, such as detailed notification logs. |
public static final int | PRIORITY_HIGHHigher {@link #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 {@link #PRIORITY_DEFAULT} items. |
public static final int | PRIORITY_MAXHighest {@link #priority}, for your application's most important items that require the
user's prompt attention or input. |
public int | priorityRelative 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 {@link #PRIORITY_HIGH} is more likely to be presented
as a heads-up notification.
|
public int | colorAccent color (an ARGB integer like the constants in {@link android.graphics.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
{@link #icon} image (stenciled in white) atop a field of this color. Alpha components are
ignored. |
public static final int | COLOR_DEFAULTSpecial value of {@link #color} telling the system not to decorate this notification with
any special color but instead use default colors when presenting this notification. |
public int | visibilitySphere 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, {@link #VISIBILITY_PRIVATE}, behaves exactly as notifications have always
done on Android: The notification's {@link #icon} and {@link #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 {@link #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â |