Skip Headers
Oracle® Java ME Embedded Application Management System API Guide
Release 3.4
  Go To Table Of Contents
Go To Index


6 Tasks

This chapter discusses tasks in the AMS. A task is an application that is running, usually started using information that the programmer provides. There can be several tasks running at the same time. Use the TaskManager, which can be obtained from the AmsFactory class, to manage classes.

TaskManager Interface

The TaskManager interface provides several helpful methods. You can obtain a list of all tasks with the getTaskList() method. To obtain the TaskInfo for the application that is currently making the call, use the getCurrentTask() method. To obtain the TaskInfo of the task that the user is interacting with in the foreground, use the getForegroundTask() method.

To initiate a task, call the startTask() method. The following information must be provided:

The programmer can also do this from the AppSuite class that represents the app.

The AMS allows the programmer to assign a TaskManagerListener that listens to any activity made by the TaskManager using the setStatusListener() method.

The TaskManager interface consists of the following methods:


The TaskInfo interface describes information about any task this is currently running. A task is always in one of four states, and has a priority from 1 to 10, as shown in Table 6-1. You can also use this class to obtain the entry class of the task. Finally, the class has three constants used to report how a task has exited.

Table 6-1 Task Status Constants in the TaskInfo Interface

Name Description


The task was destroyed and the TaskInfo descriptor is invalid.


The task has been paused.


The task is currently running.


The task is starting up.


The minimum priority for a task. Equivalent to 1.


The normal priority for a task. Equivalent to 5.


The maximum priority for a task. Equivalent to 10.


The task has finished its execution without any errors.


The task has been terminated.


The task has finished its execution with a fatal error.

The TaskInfo interface contains the following methods:

TaskManagerListener Interface

The TaskManagerListener interface is used to receive update information about a change in status of a particular task. It consists of two methods.

LoggerInfo Interface

The LoggerInfo interface is a named descriptor that is used to log output. It consists of three methods.