actionStartActivity

Function

Android
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

intentthe intent used to launch the activity
parametersthe parameters associated with the action. Parameter values will be added to the activity intent, keyed by the parameter key name string.
Android
@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

intentthe intent used to launch the activity
parametersthe parameters associated with the action. Parameter values will be added to the activity intent, keyed by the parameter key name string.
activityOptionsAdditional options built from an android.app.ActivityOptions to apply to an activity start.