Notification.Builder.AddAction Method

Definition

Overloads

Name Description
AddAction(Notification+Action)

Add an action to this notification.

AddAction(Int32, ICharSequence, PendingIntent)

This method was deprecated in API level 23.

AddAction(Int32, String, PendingIntent)

This method was deprecated in API level 23.

AddAction(Notification+Action)

Add an action to this notification.

[Android.Runtime.Register("addAction", "(Landroid/app/Notification$Action;)Landroid/app/Notification$Builder;", "GetAddAction_Landroid_app_Notification_Action_Handler")]
public virtual Android.App.Notification.Builder AddAction(Android.App.Notification.Action? action);
[<Android.Runtime.Register("addAction", "(Landroid/app/Notification$Action;)Landroid/app/Notification$Builder;", "GetAddAction_Landroid_app_Notification_Action_Handler")>]
abstract member AddAction : Android.App.Notification.Action -> Android.App.Notification.Builder
override this.AddAction : Android.App.Notification.Action -> Android.App.Notification.Builder

Parameters

action
Notification.Action

Notification.Action: the action to add

Returns

This Android.App.Notification.Builder instance, allowing calls to be chained.

Attributes

Remarks

Add an action to this notification. Actions are typically displayed by the system as a button adjacent to the notification content. Every action must have an icon (32dp square and matching the Holo Dark action bar visual style), a textual label, and a PendingIntent. A notification in its expanded form can display up to 3 actions, from left to right in the order they were added. Actions will not be displayed when the notification is collapsed, however, so be sure that any essential functions may be accessed by the user in some other way (for example, in the Activity pointed to by Notification.contentIntent).

Android reference for android.app.Notification.Builder.addAction.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

AddAction(Int32, ICharSequence, PendingIntent)

This method was deprecated in API level 23.

[Android.Runtime.Register("addAction", "(ILjava/lang/CharSequence;Landroid/app/PendingIntent;)Landroid/app/Notification$Builder;", "GetAddAction_ILjava_lang_CharSequence_Landroid_app_PendingIntent_Handler")]
public virtual Android.App.Notification.Builder? AddAction(int icon, Java.Lang.ICharSequence? title, Android.App.PendingIntent? intent);
[<Android.Runtime.Register("addAction", "(ILjava/lang/CharSequence;Landroid/app/PendingIntent;)Landroid/app/Notification$Builder;", "GetAddAction_ILjava_lang_CharSequence_Landroid_app_PendingIntent_Handler")>]
abstract member AddAction : int * Java.Lang.ICharSequence * Android.App.PendingIntent -> Android.App.Notification.Builder
override this.AddAction : int * Java.Lang.ICharSequence * Android.App.PendingIntent -> Android.App.Notification.Builder

Parameters

icon
Int32

int: resource ID of a drawable that represents the action

title
ICharSequence

CharSequence: text describing the action

intent
PendingIntent

PendingIntent: PendingIntent to be fired when the action is invoked

Returns

This Android.App.Notification.Builder instance, allowing calls to be chained.

Attributes

Remarks

This method was deprecated in API level 23. Use addAction(Action) instead.

Add an action to this notification. Actions are typically displayed by the system as a button adjacent to the notification content. Every action must have an icon (32dp square and matching the Holo Dark action bar visual style), a textual label, and a PendingIntent. A notification in its expanded form can display up to 3 actions, from left to right in the order they were added. Actions will not be displayed when the notification is collapsed, however, so be sure that any essential functions may be accessed by the user in some other way (for example, in the Activity pointed to by Notification.contentIntent). As of Android Build.VERSION_CODES.S, apps targeting API level Build.VERSION_CODES.S or higher won't be able to start activities while processing broadcast receivers or services in response to notification action clicks. To launch an activity in those cases, provide a PendingIntent to the activity itself. As of Android Build.VERSION_CODES.N, action button icons will not be displayed on action buttons, but are still required and are available to notification listeners, which may display them in other contexts, for example on a wearable device.

Android reference for android.app.Notification.Builder.addAction.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

AddAction(Int32, String, PendingIntent)

This method was deprecated in API level 23.

public Android.App.Notification.Builder? AddAction(int icon, string? title, Android.App.PendingIntent? intent);
member this.AddAction : int * string * Android.App.PendingIntent -> Android.App.Notification.Builder

Parameters

icon
Int32

int: resource ID of a drawable that represents the action

title
String

CharSequence: text describing the action

intent
PendingIntent

PendingIntent: PendingIntent to be fired when the action is invoked

Returns

This Android.App.Notification.Builder instance, allowing calls to be chained.

Remarks

This method was deprecated in API level 23. Use addAction(Action) instead.

Add an action to this notification. Actions are typically displayed by the system as a button adjacent to the notification content. Every action must have an icon (32dp square and matching the Holo Dark action bar visual style), a textual label, and a PendingIntent. A notification in its expanded form can display up to 3 actions, from left to right in the order they were added. Actions will not be displayed when the notification is collapsed, however, so be sure that any essential functions may be accessed by the user in some other way (for example, in the Activity pointed to by Notification.contentIntent). As of Android Build.VERSION_CODES.S, apps targeting API level Build.VERSION_CODES.S or higher won't be able to start activities while processing broadcast receivers or services in response to notification action clicks. To launch an activity in those cases, provide a PendingIntent to the activity itself. As of Android Build.VERSION_CODES.N, action button icons will not be displayed on action buttons, but are still required and are available to notification listeners, which may display them in other contexts, for example on a wearable device.

Android reference for android.app.Notification.Builder.addAction.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to