ActionRunRequest

ActionRunRequests provides a fluent API for running Actions.

If an action entails a UI interaction, Action.shouldRunOnMainThread will be overridden to return true so that the action runs on the UI thread when triggered asynchronously. If called by the UI thread, the action will run immediately, otherwise it will be posted to the main thread's looper. All other actions will run on their own thread. If the async run is triggered on the UI thread or a thread with a prepared looper, the optional com.urbanairship.actions.ActionCompletionCallback will be executed on the calling thread by sending a message to the calling thread's handler. If the calling thread does not have a prepared looper, the callback will be executed on the main thread.

Synchronous runs will block, and should never be called on the UI thread. It should only be used when executing actions in a separate thread, or as a convenient way of running actions from another action.

Types

Link copied to clipboard
class ActionRunResult(val arguments: ActionArguments, val result: ActionResult)
Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open fun run()

Executes the action asynchronously.

open fun run(callback: ActionCompletionCallback?)
open fun run(looper: Looper?, callback: ActionCompletionCallback?)

Executes the action asynchronously with a callback.

Link copied to clipboard

Executes the action.

Link copied to clipboard

Executes the action synchronously.

Link copied to clipboard
open fun setMetadata(metadata: Bundle?): ActionRunRequest

Sets the action argument's metadata.

Link copied to clipboard

Sets the situation.

Link copied to clipboard

Sets the action argument's value.

open fun setValue(object: Any?): ActionRunRequest

Sets the action arguments value. The object will automatically be wrapped as a ActionValue and throw an illegal argument exception if its an invalid value.