androidx.glance.appwidget.action
Interfaces
ActionCallback |
A callback executed in response to the user action, before the content is updated. |
Classes
ActionCallbackBroadcastReceiver |
Responds to broadcasts from |
ActionTrampolineActivity |
Trampoline activity for handling click interactions of list adapter items that start activities. |
InvisibleActionTrampolineActivity |
Trampoline activity for handling click interactions of list adapter items that invoke actions that don't launch an activity. |
Top-level functions summary
inline Action |
<T : ActionCallback> actionRunCallback(parameters: ActionParameters)Creates an |
Action |
<T : ActionCallback> actionRunCallback(Creates an |
inline Action |
<T : BroadcastReceiver> actionSendBroadcast()Creates an |
Action |
actionSendBroadcast(componentName: ComponentName)Creates an |
Action |
actionSendBroadcast(intent: Intent)Creates an |
Action |
<T : BroadcastReceiver> actionSendBroadcast(receiver: Class<T>)Creates an |
Action |
actionSendBroadcast(action: String, componentName: ComponentName?)Creates an |
Action |
actionStartActivity(intent: Intent, parameters: ActionParameters)Creates an |
Action |
@ExperimentalGlanceApiCreates an |
inline Action |
<T : Service> actionStartService(isForegroundService: Boolean)Creates an |
Action |
actionStartService(Creates an |
Action |
actionStartService(intent: Intent, isForegroundService: Boolean)Creates an |
Action |
<T : Service> actionStartService(Creates an |
Top-level properties summary
ActionParameters.Key<Boolean> |
This key is used to access the current checked value for actions that are triggered by compound button interactions (e.g. |
Top-level functions
actionRunCallback
inline fun <T : ActionCallback> actionRunCallback(
parameters: ActionParameters = actionParametersOf()
): Action
Creates an Action that executes a given ActionCallback implementation
| Parameters | |
|---|---|
parameters: ActionParameters = actionParametersOf() |
the parameters associated with the action |
actionRunCallback
fun <T : ActionCallback> actionRunCallback(
callbackClass: Class<T>,
parameters: ActionParameters = actionParametersOf()
): Action
Creates an Action that executes a given ActionCallback implementation
| Parameters | |
|---|---|
callbackClass: Class<T> |
the class that implements |
parameters: ActionParameters = actionParametersOf() |
the parameters associated with the action |
actionSendBroadcast
inline fun <T : BroadcastReceiver> actionSendBroadcast(): Action
Creates an Action that launches the specified BroadcastReceiver when triggered.
actionSendBroadcast
fun actionSendBroadcast(componentName: ComponentName): Action
Creates an Action that launches the BroadcastReceiver specified by the given ComponentName.
| Parameters | |
|---|---|
componentName: ComponentName |
component of the |
actionSendBroadcast
fun actionSendBroadcast(intent: Intent): Action
Creates an Action that launches a BroadcastReceiver from the given Intent when triggered. The intent should specify a component with Intent.setClass or Intent.setComponent.
| Parameters | |
|---|---|
intent: Intent |
the |
actionSendBroadcast
fun <T : BroadcastReceiver> actionSendBroadcast(receiver: Class<T>): Action
Creates an Action that launches the specified BroadcastReceiver when triggered.
| Parameters | |
|---|---|
receiver: Class<T> |
class of the |
actionSendBroadcast
fun actionSendBroadcast(action: String, componentName: ComponentName? = null): Action
Creates an Action that launches the BroadcastReceiver specified by the given action.
| Parameters | |
|---|---|
action: String |
of the BroadcastReceiver to launch |
componentName: ComponentName? = null |
optional |
actionStartActivity
fun actionStartActivity(
intent: Intent,
parameters: ActionParameters = actionParametersOf()
): Action
Creates an Action that launches an Activity from the given Intent when triggered. The intent should specify a component with Intent.setClass or Intent.setComponent.
This action is supported by app widgets only.
The given intent will be wrapped in a android.app.PendingIntent. This means that if you create multiple actions with this function, they will be conflated unless the underlying intents are distinct from one another, as defined by Intent.filterEquals. For example, if you create two Intents that target the same Activity but only differ by parameters, they will get conflated (the PendingIntent created by the first call to actionStartActivity will be overwritten by the second). A simple way to avoid this is to set a unique data URI on these intents, so that they are distinct as defined by Intent.filterEquals. There is more information in the class documentation for android.app.PendingIntent. If you do not set one, the library will add a unique URI on the intent you provide here.
| Parameters | |
|---|---|
intent: Intent |
the intent used to launch the activity |
parameters: ActionParameters = actionParametersOf() |
the parameters associated with the action. Parameter values will be added to the activity intent, keyed by the parameter key name string. |
actionStartActivity
@ExperimentalGlanceApi
fun actionStartActivity(
intent: Intent,
parameters: ActionParameters = actionParametersOf(),
activityOptions: Bundle? = null
): Action
Creates an Action that launches an Activity from the given Intent when triggered. The intent should specify a component with Intent.setClass or Intent.setComponent.
This action is supported by app widgets only.
The given intent will be wrapped in a android.app.PendingIntent. This means that if you create multiple actions with this function, they will be conflated unless the underlying intents are distinct from one another, as defined by Intent.filterEquals. For example, if you create two Intents that target the same Activity but only differ by parameters, they will get conflated (the PendingIntent created by the first call to actionStartActivity will be overwritten by the second). A simple way to avoid this is to set a unique data URI on these intents, so that they are distinct as defined by Intent.filterEquals. There is more information in the class documentation for android.app.PendingIntent. If you do not set one, the library will add a unique URI on the intent you provide here.
| Parameters | |
|---|---|
intent: Intent |
the intent used to launch the activity |
parameters: ActionParameters = actionParametersOf() |
the parameters associated with the action. Parameter values will be added to the activity intent, keyed by the parameter key name string. |
activityOptions: Bundle? = null |
Additional options built from an |
actionStartService
inline fun <T : Service> actionStartService(isForegroundService: Boolean = false): Action
Creates an Action that launches the specified Service when triggered.
| Parameters | |
|---|---|
isForegroundService: Boolean = false |
set to true when the provided |
actionStartService
fun actionStartService(
componentName: ComponentName,
isForegroundService: Boolean = false
): Action
Creates an Action that launches the Service specified by the given ComponentName.
| Parameters | |
|---|---|
componentName: ComponentName |
component of the Service to launch |
isForegroundService: Boolean = false |
set to true when the provided |
actionStartService
fun actionStartService(intent: Intent, isForegroundService: Boolean = false): Action
Creates an Action that launches a Service from the given Intent when triggered. The intent should specify a component with Intent.setClass or Intent.setComponent.
| Parameters | |
|---|---|
intent: Intent |
the intent used to launch the activity |
isForegroundService: Boolean = false |
set to true when the provided |
actionStartService
fun <T : Service> actionStartService(
service: Class<T>,
isForegroundService: Boolean = false
): Action
Creates an Action that launches the specified Service when triggered.
| Parameters | |
|---|---|
service: Class<T> |
class of the Service to launch |
isForegroundService: Boolean = false |
set to true when the provided |
Top-level properties
ToggleableStateKey
val ToggleableStateKey: ActionParameters.Key<Boolean>
This key is used to access the current checked value for actions that are triggered by compound button interactions (e.g. CheckBox, Switch). This key is used to retrieve the value from the ActionParameters passed to the action.