Skip to content

Most visited

Recently visited

navigation

NotificationCompat.Action

public static class NotificationCompat.Action
extends Object

java.lang.Object
   ↳ android.support.v4.app.NotificationCompat.Action


Structure to encapsulate a named action that can be shown as part of this notification. It must include an icon, a label, and a PendingIntent to be fired when the action is selected by the user. Action buttons won't appear on platforms prior to Android 4.1.

Apps should use addAction(int, CharSequence, PendingIntent) or addAction(NotificationCompat.Action) to attach actions.

Summary

Nested classes

class NotificationCompat.Action.Builder

Builder class for NotificationCompat.Action objects. 

interface NotificationCompat.Action.Extender

Extender interface for use with extend(NotificationCompat.Extender)

class NotificationCompat.Action.WearableExtender

Wearable extender for notification actions. 

Fields

public PendingIntent actionIntent

Intent to send when the user invokes this action.

public int icon

Small icon representing the action.

public CharSequence title

Title of the action.

Public constructors

NotificationCompat.Action(int icon, CharSequence title, PendingIntent intent)

Public methods

PendingIntent getActionIntent()
boolean getAllowGeneratedReplies()

Return whether the platform should automatically generate possible replies for this NotificationCompat.Action

RemoteInput[] getDataOnlyRemoteInputs()

Get the list of inputs to be collected from the user that ONLY accept data when this action is sent.

Bundle getExtras()

Get additional metadata carried around with this Action.

int getIcon()
RemoteInput[] getRemoteInputs()

Get the list of inputs to be collected from the user when this action is sent.

CharSequence getTitle()

Inherited methods

From class java.lang.Object

Fields

actionIntent

added in version 22.0.0
PendingIntent actionIntent

Intent to send when the user invokes this action. May be null, in which case the action may be rendered in a disabled presentation.

icon

added in version 22.0.0
int icon

Small icon representing the action.

title

added in version 22.0.0
CharSequence title

Title of the action.

Public constructors

NotificationCompat.Action

added in version 22.0.0
NotificationCompat.Action (int icon, 
                CharSequence title, 
                PendingIntent intent)

Parameters
icon int

title CharSequence

intent PendingIntent

Public methods

getActionIntent

added in version 22.0.0
PendingIntent getActionIntent ()

Returns
PendingIntent

getAllowGeneratedReplies

added in version 24.0.0
boolean getAllowGeneratedReplies ()

Return whether the platform should automatically generate possible replies for this NotificationCompat.Action

Returns
boolean

getDataOnlyRemoteInputs

added in version 26.0.0
RemoteInput[] getDataOnlyRemoteInputs ()

Get the list of inputs to be collected from the user that ONLY accept data when this action is sent. These remote inputs are guaranteed to return true on a call to isDataOnly().

May return null if no data-only remote inputs were added.

This method exists so that legacy RemoteInput collectors that pre-date the addition of non-textual RemoteInputs do not access these remote inputs.

Returns
RemoteInput[]

getExtras

added in version 22.0.0
Bundle getExtras ()

Get additional metadata carried around with this Action.

Returns
Bundle

getIcon

added in version 22.0.0
int getIcon ()

Returns
int

getRemoteInputs

added in version 22.0.0
RemoteInput[] getRemoteInputs ()

Get the list of inputs to be collected from the user when this action is sent. May return null if no remote inputs were added. Only returns inputs which accept a text input. For inputs which only accept data use getDataOnlyRemoteInputs().

Returns
RemoteInput[]

getTitle

added in version 22.0.0
CharSequence getTitle ()

Returns
CharSequence

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.