Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/app/Notification.Action#nestedclasses) \| [Constants](https://developer.android.com/reference/android/app/Notification.Action#constants) \| [Inherited Constants](https://developer.android.com/reference/android/app/Notification.Action#inhconstants) \| [Fields](https://developer.android.com/reference/android/app/Notification.Action#lfields) \| [Ctors](https://developer.android.com/reference/android/app/Notification.Action#pubctors) \| [Methods](https://developer.android.com/reference/android/app/Notification.Action#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/app/Notification.Action#inhmethods)

# Notification.Action

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/app/Notification.Action "View this page in Kotlin") \|Java


`
public
static


class
Notification.Action
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


implements

https://developer.android.com/reference/android/os/Parcelable


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.app.Notification.Action |

<br />

*** ** * ** ***

Structure to encapsulate a named action that can be shown as part of this notification.
It must include an icon, a label, and a `https://developer.android.com/reference/android/app/PendingIntent` to be fired when the action is
selected by the user.


Apps should use `https://developer.android.com/reference/android/app/Notification.Builder#addAction(int,%20java.lang.CharSequence,%20android.app.PendingIntent)`
or `https://developer.android.com/reference/android/app/Notification.Builder#addAction(android.app.Notification.Action)`
to attach actions.


As of Android `https://developer.android.com/reference/android/os/Build.VERSION_CODES#S`, apps targeting API level `https://developer.android.com/reference/android/os/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 `https://developer.android.com/reference/android/app/PendingIntent` for the activity itself.

## Summary

| ### Nested classes ||
|---|---|
| ` class` | `https://developer.android.com/reference/android/app/Notification.Action.Builder` Builder class for `https://developer.android.com/reference/android/app/Notification.Action` objects. |
| ` interface` | `https://developer.android.com/reference/android/app/Notification.Action.Extender` Extender interface for use with `https://developer.android.com/reference/android/app/Notification.Action.Builder#extend(android.app.Notification.Action.Extender)`. |
| ` class` | `https://developer.android.com/reference/android/app/Notification.Action.WearableExtender` Wearable extender for notification actions. |

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/app/Notification.Action#SEMANTIC_ACTION_ARCHIVE` `SemanticAction`: Archive the content associated with the notification. |
| `int` | `https://developer.android.com/reference/android/app/Notification.Action#SEMANTIC_ACTION_CALL` `SemanticAction`: Call a contact, group, etc. |
| `int` | `https://developer.android.com/reference/android/app/Notification.Action#SEMANTIC_ACTION_DELETE` `SemanticAction`: Delete the content associated with the notification. |
| `int` | `https://developer.android.com/reference/android/app/Notification.Action#SEMANTIC_ACTION_MARK_AS_READ` `SemanticAction`: Mark content as read. |
| `int` | `https://developer.android.com/reference/android/app/Notification.Action#SEMANTIC_ACTION_MARK_AS_UNREAD` `SemanticAction`: Mark content as unread. |
| `int` | `https://developer.android.com/reference/android/app/Notification.Action#SEMANTIC_ACTION_MUTE` `SemanticAction`: Mute the content associated with the notification. |
| `int` | `https://developer.android.com/reference/android/app/Notification.Action#SEMANTIC_ACTION_NONE` No semantic action defined. |
| `int` | `https://developer.android.com/reference/android/app/Notification.Action#SEMANTIC_ACTION_REPLY` `SemanticAction`: Reply to a conversation, chat, group, or wherever replies may be appropriate. |
| `int` | `https://developer.android.com/reference/android/app/Notification.Action#SEMANTIC_ACTION_THUMBS_DOWN` `SemanticAction`: Mark content with a thumbs down. |
| `int` | `https://developer.android.com/reference/android/app/Notification.Action#SEMANTIC_ACTION_THUMBS_UP` `SemanticAction`: Mark content with a thumbs up. |
| `int` | `https://developer.android.com/reference/android/app/Notification.Action#SEMANTIC_ACTION_UNMUTE` `SemanticAction`: Unmute the content associated with the notification. |

| ### Inherited constants |
|---|
| From interface `https://developer.android.com/reference/android/os/Parcelable` |---|---| | `int` | `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` Descriptor bit used with `https://developer.android.com/reference/android/os/Parcelable#describeContents()`: indicates that the Parcelable object's flattened representation includes a file descriptor. | | `int` | `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE` Flag for use with `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`: the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`". | |

| ### Fields ||
|---|---|
| ` public static final https://developer.android.com/reference/android/os/Parcelable.Creator<https://developer.android.com/reference/android/app/Notification.Action>` | `https://developer.android.com/reference/android/app/Notification.Action#CREATOR` |
| ` public https://developer.android.com/reference/android/app/PendingIntent` | `https://developer.android.com/reference/android/app/Notification.Action#actionIntent` Intent to send when the user invokes this action. |
| ` public int` | `https://developer.android.com/reference/android/app/Notification.Action#icon` *This field was deprecated in API level 23. Use `https://developer.android.com/reference/android/app/Notification.Action#getIcon()` instead.* |
| ` public https://developer.android.com/reference/java/lang/CharSequence` | `https://developer.android.com/reference/android/app/Notification.Action#title` Title of the action. |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/app/Notification.Action#Action(int,%20java.lang.CharSequence,%20android.app.PendingIntent)(int icon, https://developer.android.com/reference/java/lang/CharSequence title, https://developer.android.com/reference/android/app/PendingIntent intent) ` *This constructor is deprecated. Use `https://developer.android.com/reference/android/app/Notification.Action.Builder`.* |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/app/Notification.Action` | ` https://developer.android.com/reference/android/app/Notification.Action#clone()() ` Creates and returns a copy of this object. |
| ` int` | ` https://developer.android.com/reference/android/app/Notification.Action#describeContents()() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
| ` boolean` | ` https://developer.android.com/reference/android/app/Notification.Action#getAllowGeneratedReplies()() ` Return whether the platform should automatically generate possible replies for this `https://developer.android.com/reference/android/app/Notification.Action` |
| ` https://developer.android.com/reference/android/app/RemoteInput` | ` https://developer.android.com/reference/android/app/Notification.Action#getDataOnlyRemoteInputs()() ` Get the list of inputs to be collected from the user that ONLY accept data when this action is sent. |
| ` https://developer.android.com/reference/android/os/Bundle` | ` https://developer.android.com/reference/android/app/Notification.Action#getExtras()() ` Get additional metadata carried around with this Action. |
| ` https://developer.android.com/reference/android/graphics/drawable/Icon` | ` https://developer.android.com/reference/android/app/Notification.Action#getIcon()() ` Return an icon representing the action. |
| ` https://developer.android.com/reference/android/app/RemoteInput` | ` https://developer.android.com/reference/android/app/Notification.Action#getRemoteInputs()() ` Get the list of inputs to be collected from the user when this action is sent. |
| ` int` | ` https://developer.android.com/reference/android/app/Notification.Action#getSemanticAction()() ` Returns the `SemanticAction` associated with this `https://developer.android.com/reference/android/app/Notification.Action`. |
| ` boolean` | ` https://developer.android.com/reference/android/app/Notification.Action#isAuthenticationRequired()() ` Returns whether the OS should only send this action's `https://developer.android.com/reference/android/app/PendingIntent` on an unlocked device. |
| ` boolean` | ` https://developer.android.com/reference/android/app/Notification.Action#isContextual()() ` Returns whether this is a contextual Action, i.e. |
| ` void` | ` https://developer.android.com/reference/android/app/Notification.Action#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel out, int flags) ` Flatten this object in to a Parcel. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||
| From interface ` https://developer.android.com/reference/android/os/Parcelable ` |---|---| | ` abstract int` | ` https://developer.android.com/reference/android/os/Parcelable#describeContents()() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. | | ` abstract void` | ` https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags) ` Flatten this object in to a Parcel. | ||

## Constants

### SEMANTIC_ACTION_ARCHIVE

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SEMANTIC_ACTION_ARCHIVE
```

`SemanticAction`: Archive the content associated with the notification. This
could mean archiving an email, message, etc.

<br />

Constant Value:

5
(0x00000005)


### SEMANTIC_ACTION_CALL

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SEMANTIC_ACTION_CALL
```

`SemanticAction`: Call a contact, group, etc.

<br />

Constant Value:

10
(0x0000000a)


### SEMANTIC_ACTION_DELETE

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SEMANTIC_ACTION_DELETE
```

`SemanticAction`: Delete the content associated with the notification. This
could mean deleting an email, message, etc.

<br />

Constant Value:

4
(0x00000004)


### SEMANTIC_ACTION_MARK_AS_READ

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SEMANTIC_ACTION_MARK_AS_READ
```

`SemanticAction`: Mark content as read.

<br />

Constant Value:

2
(0x00000002)


### SEMANTIC_ACTION_MARK_AS_UNREAD

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SEMANTIC_ACTION_MARK_AS_UNREAD
```

`SemanticAction`: Mark content as unread.

<br />

Constant Value:

3
(0x00000003)


### SEMANTIC_ACTION_MUTE

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SEMANTIC_ACTION_MUTE
```

`SemanticAction`: Mute the content associated with the notification. This could
mean silencing a conversation or currently playing media.

<br />

Constant Value:

6
(0x00000006)


### SEMANTIC_ACTION_NONE

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SEMANTIC_ACTION_NONE
```

No semantic action defined.

<br />

Constant Value:

0
(0x00000000)


### SEMANTIC_ACTION_REPLY

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SEMANTIC_ACTION_REPLY
```

`SemanticAction`: Reply to a conversation, chat, group, or wherever replies
may be appropriate.

<br />

Constant Value:

1
(0x00000001)


### SEMANTIC_ACTION_THUMBS_DOWN

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SEMANTIC_ACTION_THUMBS_DOWN
```

`SemanticAction`: Mark content with a thumbs down.

<br />

Constant Value:

9
(0x00000009)


### SEMANTIC_ACTION_THUMBS_UP

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SEMANTIC_ACTION_THUMBS_UP
```

`SemanticAction`: Mark content with a thumbs up.

<br />

Constant Value:

8
(0x00000008)


### SEMANTIC_ACTION_UNMUTE

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int SEMANTIC_ACTION_UNMUTE
```

`SemanticAction`: Unmute the content associated with the notification. This could
mean un-silencing a conversation or currently playing media.

<br />

Constant Value:

7
(0x00000007)


## Fields

### CREATOR

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final Creator<Notification.Action> CREATOR
```

<br />

<br />

### actionIntent

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public 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 by the system UI.

<br />

### icon

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int icon
```


**This field was deprecated
in API level 23.**   

Use `https://developer.android.com/reference/android/app/Notification.Action#getIcon()` instead.

Small icon representing the action.

<br />

### title

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public CharSequence title
```

Title of the action.

<br />

## Public constructors

### Action

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Action (int icon, 
                CharSequence title, 
                PendingIntent intent)
```


**This constructor is deprecated.**   

Use `https://developer.android.com/reference/android/app/Notification.Action.Builder`.

<br />

<br />

| Parameters ||
|---|---|
| `icon` | `int` <br /> |
| `title` | `CharSequence` <br /> |
| `intent` | `PendingIntent`: This value may be `null`. <br /> |

## Public methods

### clone

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Notification.Action clone ()
```

Creates and returns a copy of this object. The precise meaning
of "copy" may depend on the class of the object. The general
intent is that, for any object `x`, the expression:
>
> ```
>  x.clone() != x
> ```
will be true, and that the expression:
>
> ```
>  x.clone().getClass() == x.getClass()
> ```
will be `true`, but these are not absolute requirements. While it is typically the case that:
>
> ```
>  x.clone().equals(x)
> ```
will be `true`, this is not an absolute requirement.


By convention, the returned object should be obtained by calling
`super.clone`. If a class and all of its superclasses (except
`Object`) obey this convention, it will be the case that
`x.clone().getClass() == x.getClass()`.


By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
by `super.clone` before returning it. Typically, this means
copying any mutable objects that comprise the internal "deep structure"
of the object being cloned and replacing the references to these
objects with references to the copies. If a class contains only
primitive fields or references to immutable objects, then it is usually
the case that no fields in the object returned by `super.clone`
need to be modified.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/Notification.Action` | a clone of this instance. <br /> |

### describeContents

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int describeContents ()
```

Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation. For example, if the object will
include a file descriptor in the output of `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`,
the return value of this method must include the
`https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` bit.

<br />

| Returns ||
|---|---|
| `int` | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either `0` or - `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` |

### getAllowGeneratedReplies

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean getAllowGeneratedReplies ()
```

Return whether the platform should automatically generate possible replies for this
`https://developer.android.com/reference/android/app/Notification.Action`

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### getDataOnlyRemoteInputs

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public 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
`https://developer.android.com/reference/android/app/RemoteInput#isDataOnly()`.

Returns `null` if there are no data-only remote inputs.

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

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/RemoteInput` | <br /> |

### getExtras

Added in [API level 20](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Bundle getExtras ()
```

Get additional metadata carried around with this Action.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/os/Bundle` | <br /> |

### getIcon

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Icon getIcon ()
```

Return an icon representing the action.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/drawable/Icon` | <br /> |

### getRemoteInputs

Added in [API level 20](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public 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 `https://developer.android.com/reference/android/app/Notification.Action#getDataOnlyRemoteInputs()`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/RemoteInput` | <br /> |

### getSemanticAction

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getSemanticAction ()
```

Returns the `SemanticAction` associated with this `https://developer.android.com/reference/android/app/Notification.Action`. A
`SemanticAction` denotes what an `https://developer.android.com/reference/android/app/Notification.Action`'s `https://developer.android.com/reference/android/app/PendingIntent` will do
(eg. reply, mark as read, delete, etc).

<br />

| Returns ||
|---|---|
| `int` | Value is one of the following: - `https://developer.android.com/reference/android/app/Notification.Action#SEMANTIC_ACTION_NONE` - `https://developer.android.com/reference/android/app/Notification.Action#SEMANTIC_ACTION_REPLY` - `https://developer.android.com/reference/android/app/Notification.Action#SEMANTIC_ACTION_MARK_AS_READ` - `https://developer.android.com/reference/android/app/Notification.Action#SEMANTIC_ACTION_MARK_AS_UNREAD` - `https://developer.android.com/reference/android/app/Notification.Action#SEMANTIC_ACTION_DELETE` - `https://developer.android.com/reference/android/app/Notification.Action#SEMANTIC_ACTION_ARCHIVE` - `https://developer.android.com/reference/android/app/Notification.Action#SEMANTIC_ACTION_MUTE` - `https://developer.android.com/reference/android/app/Notification.Action#SEMANTIC_ACTION_UNMUTE` - `https://developer.android.com/reference/android/app/Notification.Action#SEMANTIC_ACTION_THUMBS_UP` - `https://developer.android.com/reference/android/app/Notification.Action#SEMANTIC_ACTION_THUMBS_DOWN` - `https://developer.android.com/reference/android/app/Notification.Action#SEMANTIC_ACTION_CALL` |

### isAuthenticationRequired

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isAuthenticationRequired ()
```

Returns whether the OS should only send this action's `https://developer.android.com/reference/android/app/PendingIntent` on an
unlocked device.

If the device is locked when the action is invoked, the OS should show the keyguard
and require successful authentication before invoking the intent.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### isContextual

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isContextual ()
```

Returns whether this is a contextual Action, i.e. whether the action is dependent on the
notification message body. An example of a contextual action could be an action opening a
map application with an address shown in the notification.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### writeToParcel

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void writeToParcel (Parcel out, 
                int flags)
```

Flatten this object in to a Parcel.

<br />

| Parameters ||
|---|---|
| `out` | `Parcel`: The Parcel in which the object should be written. This value cannot be `null`. <br /> |
| `flags` | `int`: Additional flags about how the object should be written. May be 0 or `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE` |