MIDlet
A MIDlet, a Java program for embedded devices, is an application written for MIDP (Mobile Information Device Profile).
MIDlet applications are subclasses of the javax.microedition.midlet.MIDlet class that is defined by MIDP.
A MIDlet has to fulfill the following requirements in order to run on a mobile phone:
- The main class is a subclass of
javax.microedition.midlet.MIDlet
.
- If an application consists of multiple classes, a
.jar
file is used to group all the classes together so that the application is easy to distribute and deploy.
The jar tool could be used.
- The
.jar
file needs to be pre-verified by using a preverifier.
It preprocesses the program for use by the K virtual machine (KVM) without changing the name of a class.
†Note that the MIDlet development environment KToolbar
of J2ME Wireless Toolkit 2.3
has simplified the above steps.
The following list gives hints for writing MIDlets:
- Heap sizes can be very small, around 200KB.
- Programs can not expect more than 20KB persistent storage.
- A device can have very different screen dimensions, orientations, and color depths.
In other words, do not use absolute position.
- Not all devices have keypads or pointers.
One should be able to use the program with both.
Key layouts may vary too, so use
Game Actions
for up-down-left-right-action
style events.
- Do not white list devices.
If the program has not been tested on a specific device, assume it works.
Never attempt to block the user from trying it.
- Use an
obfuscator
such as Proguard
to compress the MIDlet size.