MIDlet
A MIDlet is software for a mobile phone or comparable mobile device ( smartphone , sensor network node ), which is written in the Java programming language and corresponds to the Mobile Information Device Profile ( MIDP ). MIDP is in turn part of the Java Platform Micro Edition ( Java ME ) and one of the profiles of the Connected Limited Device Configuration CLDC .
Several MIDlets can be combined to form a MIDlet suite so that the individual MIDlets can share resources and program code.
Many of the existing paid games for mobile phones are embedded Java MIDlets . The free applications ranging from small e-book -Readern over calendar - or Telnet -Clienten to a BASIC - interpreter .
structure
MIDlets consist of 2 files: a "program name" .jad and a "program name" .jar file. The .jad file contains information about the MIDP version, the manufacturer and where the application can be downloaded. The .jar file is the actual executable program and can partly also be installed or distributed without the associated .jad file.
MIDlet lifecycle
Once started, MIDlets can be in multiple states and switch between them. The Java Application Management Software (AMS) controls the life cycle of a MIDlet. This program manager is responsible, among other things, for initializing, starting, pausing, resuming and terminating MIDlets. Accordingly, a MIDlet can have four states: Loaded , Paused , Active and Destroyed .
After a MIDlet has been loaded, it begins its life in the Loaded / Paused state . The program manager calls startApp()
and the MIDlet changes to the Paused state . There are three other ways to get into the Paused state . First, when the program manager pauseApp()
calls the method . This can e.g. B. be done by an incoming phone call. Second, when the MIDlet notifyPaused()
pauses itself by calling the method . Third, if startApp()
one MIDletStateChangeException
generates. The program manager calls this method either after the initialization or later in order to return to the Active state . If a MIDlet is in pause , the running processes of the MIDlet should be stopped so that the application in the foreground gets all resources available, there are no resource conflicts and the battery is not unnecessarily burdened. Active MIDlets ( Active ) carry out the tasks assigned to them and thus use resources for themselves. The Destroyed state can be reached either from Paused or Active . To exit the MIDlet, the program manager calls destroyApp()
with the boolean argument unconditional
. This method allows final commands to be performed before final termination, such as: B. Free up reserved memory or close open connections. If the program manager decides to terminate the MIDlet, but it is currently performing important functions, setting the parameter unconditional
to false
a forced termination can prevent. There is no guarantee for this, however. How it reacts depends on the device. The program manager usually waits for a while and then tries to close the MIDlet again. If the unconditional
same true
, the MIDlet is forced to terminate, regardless of the importance of running processes.