java.lang.Object | |
↳ | com.urbanairship.actions.Action |
![]() |
![]() |
The base action class that describes an operation to perform.
An action is an abstraction over a unary function, which takesActionArguments
and performs a defined task,
producing an optional ActionResult
. Actions
may restrict or vary the work they perform depending on the arguments they
receive, which may include type introspection and runtime context.
In the larger view, the Actions framework provides a convenient way to
automatically perform tasks by name in response to push notifications,
Rich App Page interactions and JavaScript.
The UA library comes with pre-made actions for common tasks such as setting
tags and opening URLs out of the box, but this class can also be extended to
enable custom app behaviors and engagement experiences.
While actions can be run manually, typically they are associated with names
in the ActionRegistry
, and run
on their own threads with the ActionRunRequest
.
Actions that are either long lived or are unable to be interrupted by the device
going to sleep should request a wake lock before performing. This is especially
important for actions that are performing in Situation.PUSH_RECEIVED, when a
push is delivered when the device is not active.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
class | Action.ActivityResult | Wraps the result code and data from starting an activity for a result. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Action() |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
boolean |
acceptsArguments(ActionArguments arguments)
Called before an action is performed to determine if the
the action can accept the arguments.
| ||||||||||
void |
onFinish(ActionArguments arguments, ActionResult result)
Called after the action performs.
| ||||||||||
void |
onStart(ActionArguments arguments)
Called before an action is performed.
| ||||||||||
abstract ActionResult |
perform(ActionArguments arguments)
Performs the action.
| ||||||||||
final int[] |
requestPermissions(String... permissions)
Requests permissions.
| ||||||||||
final Action.ActivityResult |
startActivityForResult(Intent intent)
Starts an activity for a result.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Called before an action is performed to determine if the the action can accept the arguments.
arguments | The action arguments. |
---|
true
if the action can perform with the arguments,
otherwise false
.
Called after the action performs.
arguments | The action arguments. |
---|---|
result | The result of the action. |
Called before an action is performed.
arguments | The action arguments. |
---|
Performs the action.
arguments | The action arguments. |
---|
Requests permissions.
permissions | The permissions to request. |
---|
Starts an activity for a result.
intent | The activity to start. |
---|