Urban Airship Actions provides a convenient way to automatically perform tasks by name in response to push notifications, Message Center interactions and JavaScript.

An action is an abstraction over a unary function, which takes an argument and performs a defined task, producing an optional result. Actions may restrict or vary the work they perform depending on the arguments they receive, which may include type introspection and runtime context.

The Urban Airship SDK comes with pre-made actions for common tasks such as setting/modifying tags, showing a landing page, scheduling or canceling action schedules, and deep linking. Actions can also be extended to enable custom application behaviors and engagement experiences.

Actions are sent with a push by supplying a JSON payload as a push extra with the key com.urbanairship.actions. The JSON payload is a map of the action names to action values. The values can be any valid JSON value.

Action Situations

Actions are triggered with additional context in the form of a Situation, which corresponds to the way the action was triggered. The different situations allow actions to determine whether they should run, or potentially perform different behaviors depending on this context.

Action is invoked manually.
Action is triggered when a push is received.
Action is triggered when a notification is opened.
Action is triggered from a web view.
Action is triggered from a foreground notification action button.
Action is triggered from a background notification action button.
Action is triggered from automation.

Action Registry

The action registry is the central place to register actions by name. Each entry in the registry contains an action, the names that the action is registered under, a predicate that allows filtering when an action can run, and allows specifying alternative actions for different situations.

Registering an action
Action customAction = new CustomAction();
         .registerAction(customAction, "my_action_name");
Looking up an entry
ActionRegistry.Entry entry = UAirship.shared()
Setting a predicate
// Predicate that will reject PUSH_RECEIVED causing the action to never run during that situation.
Predicate<ActionArguments> rejectPushReceivedPredicate = new Predicate<ActionArguments>() {
    public boolean apply(ActionArguments arguments) {
        return !(Situation.PUSH_RECEIVED.equals(arguments.getSituation()));


Triggering Actions

Actions can be triggered programmatically through an ActionRunRequest , by defining actions in a push notification, from JavaScript using a Custom HTML Template, or from an automation schedule.

The ActionRunRequest class provides a fluent API for running actions. The action run request takes in a value, situation, and metadata and constructs the ActionArguments and passes it to the action to run.

The ActionArguments value can only contain an ActionValue instance. ActionValue is a class that limits the type of values to those that can be JSON serializable and contain getter methods that automatically do type checking to parse value back into its original form. Each action is run on its own thread when triggered asynchronously. Synchronous runs will block and should never be called on the UI thread.

// Running an action directly through the ActionRunRequest

// Running an action by registered name

// An optional callback when finished
                .run(new ActionCompletionCallback() {
                    public void onFinish(ActionArguments arguments, ActionResult result) {
              "Action finished!  Result: " + result);

// Block until the action finishes
ActionResult result = ActionRunRequest.createRequest("my_action_name")

Available Actions

The landing page action allows showing a rich content page in an overlay.
The open external URL action allows launching any URL. The action will construct an intent with a given URI and try to start an activity with it for viewing.
The deep link action works exactly as the Open External URL Action. It constructs an intent with a given URI and tries to launch an activity. The deep linking strategy assumes the application is set up to handle URIs. See Deep Linking for Android for more details on providing deep linking.
The share action constructs an intent to share the text to the application. The Android chooser activity will be started to pick the application used to share the text.
The add tags action allows adding one or more tags to the device. Note: this action is a no-op if channelTagRegistrationEnabled is set to false on PushManager .
The remove tags action allows removing one or more tags from the device.
The custom event action creates and adds a custom event. See Custom Events documentation for more details on Custom Events.
The clipboard action copies text to the system clipboard.
The open rich push inbox action will try to start an activity to view either the Message Center Inbox or Message if a message ID is supplied as the argument's value and the message is present in the inbox.
The overlay rich push action will display a Message Center Message in the landing page activity.
The wallet action allows opening Google Pay deep links.
The schedule action schedules an automation action.
The cancel schedules action cancels automation actions.
The fetch device info action gets an updated snapshot of the device's information from the JavaScript bridge.
The enable feature action enables an Urban Airship feature, such as location, background location, or user notifications.

Custom Actions

The action framework supports any custom actions. Create an action by extending the base action class, then register the action to the registry after UAirship.takeOff .

Custom Action
public class CustomAction extends Action {

    public boolean acceptsArguments(ActionArguments arguments) {
        if (!super.acceptsArguments(arguments)) {
            return false;

        // Do any argument inspections. The action will stop
        // execution if this method returns false.

        return true;

    public ActionResult perform(ActionArguments arguments) {"Action is performing!");

        return ActionResult.newEmptyResult();
Register the action after takeOff
public void onAirshipReady(UAirship airship) {
             .registerAction(new CustomAction(), "my_custom_action");

The action can then be triggered the same way as the built-in actions.


Actions that are long-lived 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.