Velocity API: Action.launch()

Version 2

    Return To Index

    Action.launch()

    Overview

    Launches an Android Activity that allows the Client to interact with other software loaded on the device.

    Calls to Action.launch() are asynchronous and the script will continue to execute even through the activity has not returned.

    Activities are started using intents. The intent is represented as a JavaScript object with certain properties.

    • Intents must have at least an action or a class and package combination.
    • If multiple applications match the intent, a chooser dialog will appear.

    Format

    Action.launch(intent);
    Intent object properties

     

    ValueDescriptionTypeRequiredNotes
    actionA string representing the action to be performed.StringOptionalIf the device has multiple apps registered to handle an action, a chooser dialog appears.
    categoriesA list of required categories for the activity that is being started.Array of stringsOptional
    classThe name of the activity class to explicitly launch.StringOptionalMust be used with package.
    packageThe name of the application package to explicitly launch.StringOptionalMust be used with class.
    extrasPasses additional data to the invoked app.Array of objectsOptionalIf you use extras, you must specify the name, value, and type (string or integer) for the data.

     

    Example

    /* Start the calculator activity. */   
    Action.launch({
         action:'android.intent.action.MAIN',
         categories:['android.intent.category.APP_CALCULATOR']
    });