/pps/services/app-launcher

Control object for launching applications based on name

Publishers
Launcher service; any app
Subscribers
Launcher service; any app

Overview

The launcher service (Application Launcher) provides this control object so clients can issue commands to start and stop applications based on their names. This object allows third-party applications such as speech-recognition programs to launch other applications simply by naming them, without having to read the /apps directory to obtain the app ID string. You can also read this object to learn the names of the installed applications.

Command format

Commands sent to the /pps/services/app-launcher object are of the form:

req:json:{"id":ID_number,"cmd":"command_string","app":"app_string","dat":""}

The ID_number is a unique identifier that will be reflected in the response to your request. You can set the ID to any number you wish.

The dat attribute is used for setting parameters that will be sent to the launcher service. Parameters can be either strings or JSON objects.

Starting and stopping applications

At boot time, Application Launcher publishes the names of all existing applications in the app_list attribute:

app_list:json:[app_string,app_string,...]

You can launch any application given in app_list by issuing the launch app command. For example, to launch the application named "MediaPlayer", issue this command:

echo 'req:json:{"id":1,"cmd":"launch app","app":"MediaPlayer","dat":""}' >> /pps/services/app-launcher

To stop the MediaPlayer application, send the close app command:

echo 'req:json:{"id":1,"cmd":"close app","app":"MediaPlayer","dat":""}' >> /pps/services/app-launcher

Responses

Application Launcher responds to each command by writing to the status attribute. This attribute contains the ID number used in the previously issued command as well as any errors that may have occurred. For example:

status:json:{"error":"OK","id":1}

This response indicates that the command with ID 1 was executed successfully.

Note: Application Launcher creates the /pps/system/navigator/command object for publishing application tab actions. Applications that subscribe to this object should open it using the ?wait and ?delta options, to receive all relevant changes. For information on these options, see "Subscribing" in the Persistent Publish/Subscribe Developer's Guide.