# ActionCallback

# ActionCallback

Artifact:[androidx.glance:glance-appwidget](https://developer.android.com/jetpack/androidx/releases/glance)  
[View Source](https://cs.android.com/search?q=file:androidx/glance/appwidget/action/RunCallbackAction.kt+class:androidx.glance.appwidget.action.ActionCallback)  
Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/glance#1.0.0)

<br />

```
interface ActionCallback
```

<br />

*** ** * ** ***

A callback executed in response to the user action, before the content is updated. The implementing class must have a public zero argument constructor, this is used to instantiate the class at runtime.

## Summary

|                                  ### Public functions                                   |
|-----------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `suspend `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onAction](https://developer.android.com/reference/kotlin/androidx/glance/appwidget/action/ActionCallback#onAction(android.content.Context,androidx.glance.GlanceId,androidx.glance.action.ActionParameters))`(` ` context: `[Context](https://developer.android.com/reference/android/content/Context.html)`,` ` glanceId: `[GlanceId](https://developer.android.com/reference/kotlin/androidx/glance/GlanceId)`,` ` parameters: `[ActionParameters](https://developer.android.com/reference/kotlin/androidx/glance/action/ActionParameters) `)` Performs the work associated with this action. |

## Public functions

### onAction

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/glance#1.0.0)  

```
suspend fun onAction(
    context: Context,
    glanceId: GlanceId,
    parameters: ActionParameters
): Unit
```

Performs the work associated with this action. Called when the action is triggered.  

|                                                        Parameters                                                        |
|--------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------|
| `context: `[Context](https://developer.android.com/reference/android/content/Context.html)                               | the calling context                                                                                              |
| `glanceId: `[GlanceId](https://developer.android.com/reference/kotlin/androidx/glance/GlanceId)                          | the[GlanceId](https://developer.android.com/reference/kotlin/androidx/glance/GlanceId)that triggered this action |
| `parameters: `[ActionParameters](https://developer.android.com/reference/kotlin/androidx/glance/action/ActionParameters) | the parameters associated with the action                                                                        |