belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1
NotificationCompat.Builder
public
static
class
NotificationCompat.Builder
extends Object
java.lang.Object | |
↳ | android.support.v4.app.NotificationCompat.Builder |
Builder class for NotificationCompat
objects. Allows easier control over
all the flags, as well as help constructing the typical notification layouts.
On platform versions that don't offer expanded notifications, methods that depend on expanded notifications have no effect.
For example, action buttons won't appear on platforms prior to Android 4.1. Action buttons depend on expanded notifications, which are only available in Android 4.1 and later.
For this reason, you should always ensure that UI controls in a notification are also
available in an Activity
in your app, and you should always start that
Activity
when users click the notification. To do this, use the
setContentIntent()
method.
Summary
Fields | |
---|---|
public
ArrayList<String> |
mPeople
This field was deprecated in API level 27.1.0. This field was not meant to be public. |
Public constructors | |
---|---|
NotificationCompat.Builder(Context context, String channelId)
Constructor. |
|
NotificationCompat.Builder(Context context)
This constructor was deprecated
in API level 26.1.0.
use |
Public methods | |
---|---|
NotificationCompat.Builder
|
addAction(NotificationCompat.Action action)
Add an action to this notification. |
NotificationCompat.Builder
|
addAction(int icon, CharSequence title, PendingIntent intent)
Add an action to this notification. |
NotificationCompat.Builder
|
addExtras(Bundle extras)
Merge additional metadata into this notification. |
NotificationCompat.Builder
|
addInvisibleAction(NotificationCompat.Action action)
Add an invisible action to this notification. |
NotificationCompat.Builder
|
addInvisibleAction(int icon, CharSequence title, PendingIntent intent)
Add an invisible action to this notification. |
NotificationCompat.Builder
|
addPerson(String uri)
Add a person that is relevant to this notification. |
Notification
|
build()
Combine all of the options that have been set and return a new |
NotificationCompat.Builder
|
extend(NotificationCompat.Extender extender)
Apply an extender to this notification builder. |
Bundle
|
getExtras()
Get the current metadata Bundle used by this notification Builder. |
Notification
|
getNotification()
This method was deprecated
in API level 22.1.0.
Use |
NotificationCompat.Builder
|
setAutoCancel(boolean autoCancel)
Setting this flag will make it so the notification is automatically canceled when the user clicks it in the panel. |
NotificationCompat.Builder
|
setBadgeIconType(int icon)
Sets which icon to display as a badge for this notification. |
NotificationCompat.Builder
|
setCategory(String category)
Set the notification category. |
NotificationCompat.Builder
|
setChannelId(String channelId)
Specifies the channel the notification should be delivered on. |
NotificationCompat.Builder
|
setColor(int argb)
Sets |
NotificationCompat.Build |