Application Management Software

Note: Application Management Software (AMS) is known as Java Application Manager (JAM) in Series 40 platform. For purposes of this library, the term AMS is used to refer to both, except where otherwise indicated.

Figure: A Connect MIDlet being launched

The core of the MIDlet lifecycle is the AMS, which provides the context for all MIDlet activities. When a mobile device user selects a MIDlet for execution, the AMS instantiates it by calling the MIDlet's startApp method, which starts the lifecycle of the MIDlet. The AMS maintains control over the MIDlet lifecycle throughout its execution. There are no explicit restrictions to the number of MIDlets that can run simultaneously, although the AMS can release resources by terminating inactive MIDlets or pausing active ones. The AMS does not make a distinction between MIDlets and native applications, both of which are managed equally by the system.

The AMS controls what is shown on the device display using the concepts of foreground and background. Only one application is active at a time on the foreground, with all the other running applications relegated to background. The interaction between these two states is as follows:

  • In a foreground MIDlet, call Display.setCurrent(null) to send the MIDlet to the background. The next application getting the foreground is determined by the AMS.

  • To activate a background MIDlet and set it to the foreground, call Display.setCurrent(Displayable). This causes view activation in the native operating system, which results in the MIDlet being brought to the foreground.

  • The AMS can send a MIDlet to the background or bring it to the foreground either as a response to user initiated actions, actions initiated by other applications, or other events. An example of such an event is an incoming phone call, which results in the AMS sending the currently active MIDlet to background.

  • The system can close a MIDlet at any time, for example due to shortage of resources such as memory. The AMS calls the MIDlet's destroyApp() method, forcing the application to a graceful exit. If this fails, the AMS terminates the MIDlet forcefully.

In addition to managing the display, AMS also organizes the MIDlet runtime states. If a sudden event that requires processing resources or input functions - such as a phone call - takes place, the AMS places the currently running application to background and receives the phone call in normal fashion.

For more information on MIDlet lifecycle, see MIDlet specification.