Builder
open class Builder
kotlin.Any | |
↳ | androidx.core.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 android.app.Activity
in your app, and you should always start that android.app.Activity
when users click the notification. To do this, use the setContentIntent()
method.
Summary
Public constructors | |
---|---|
<init>(@NonNull context: Context, @NonNull notification: Notification) Creates a NotificationCompat. |
|
Constructor. |
|
Public methods | |
---|---|
open NotificationCompat.Builder |
addAction(icon: Int, @Nullable title: CharSequence?, @Nullable intent: PendingIntent?) Add an action to this notification. |
open NotificationCompat.Builder |
addAction(@Nullable action: NotificationCompat.Action?) Add an action to this notification. |
open NotificationCompat.Builder |
Merge additional metadata into this notification. |
open NotificationCompat.Builder |
addInvisibleAction(icon: Int, @Nullable title: CharSequence?, @Nullable intent: PendingIntent?) Add an invisible action to this notification. |
open NotificationCompat.Builder |
addInvisibleAction(@Nullable action: NotificationCompat.Action?) Add an invisible action to this notification. |
open NotificationCompat.Builder |
Add a person that is relevant to this notification. |
open NotificationCompat.Builder |
Add a person that is relevant to this notification. |
open Notification |
build() Combine all of the options that have been set and return a new |
open NotificationCompat.Builder |
Clear any actions added via #addAction |
open NotificationCompat.Builder |
Clear any invisible actions added via #addInvisibleAction |
open NotificationCompat.Builder |
Clear any people added via either |
open RemoteViews? |
Construct a RemoteViews for the final big notification layout. |
open RemoteViews? |
Construct a RemoteViews for the final notification layout. |
open RemoteViews? |
Construct a RemoteViews for the final heads-up notification layout. |
open NotificationCompat.Builder |
extend(@NonNull extender: NotificationCompat.Extender) Apply an extender to this notification builder. |
open Bundle |
Get the current metadata Bundle used by this notification Builder. |
open Notification | |
open NotificationCompat.Builder |
Determines whether the platform can generate contextual actions for a notification. |
open NotificationCompat.Builder |
setAutoCancel(autoCancel: Boolean) Setting this flag will make it so the notification is automatically canceled when the user clicks it in the panel. |
open NotificationCompat.Builder |
setBadgeIconType(icon: Int) Sets which icon to display as a badge for this notification. |
open NotificationCompat.Builder |
setBubbleMetadata(@Nullable data: NotificationCompat.BubbleMetadata?) Sets the |
open NotificationCompat.Builder |
setCategory(@Nullable category: String?) Set the notification category. |
open NotificationCompat.Builder |
setChannelId(@NonNull channelId: String) Specifies the channel the notification should be delivered on. |
open NotificationCompat.Builder |
setChronometerCountDown(countsDown: Boolean) Sets the Chronometer to count down instead of counting up. |
open NotificationCompat.Builder |
Sets |
open NotificationCompat.Builder |