MIDlet
From Free net encyclopedia
A MIDlet is a Java program for embedded devices, more specifically the Java ME virtual machine. Generally, these are games and applications that run on a cell phone.
MIDlets will (should) run on any device that implements Java ME Mobile Information Device Profile. Like all Java programs, MIDlets are "compile once, run anywhere". To write a MIDlet, you can get the Sun Java Wireless Toolkit from the Java website, which is available on several platforms and is completely free.
A MIDlet has to fulfill the following requirements in order to run on a mobile phone:
- The main class needs to be a subclass of javax.microedition.midlet.MIDlet
- The MIDlet needs to be packed inside a .jar file (e.g. by using the jar-tool)
- The .jar file needs to be pre-verified by using a preverifier.
- In some cases, the .jar file needs to be signed by the mobile phone's carrier.
Contents |
[edit]
Hints for writing MIDlets
- Handsets impose a limit on the .jar file size. Nokia series 40 (1st Ed), arguably the most popular handsets for mobile gaming, has a .jar file size limit of 64kB. The MIDlet size can be reduced through application of programmatic and design optimization techniques (Template:Cite web) and the use of obfuscators, PNG optimizers, and Java ME optimizers.
- Heap sizes can be very small, around 200kb. Therefore, use as few objects as possible and delete references to them when they are no longer needed. Some image formats such as png will decompress to enormous sizes when loaded so don't keep too many of them. Catching OutOfMemoryErrors exceptions will normally not work.
- Programs can not expect more than 20kb persistent storage. Don't keep more than you need. (Newer phones support additional APIs for file storing)
- Keep in mind that a device can have very different screen dimensions, orientations and color depths. In other words, don't 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.
- Don't white list devices. If the program hasn't 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.
[edit]
References
[edit]
See also
- Mobile game
- MIDletPascal - A Pascal compiler and IDE that generates small and fast Java bytecode
[edit]
External links
- Openwap: Open Source Midlets News and Software
- An Example Midlet. Thousands of Midlets are now available. This is an example of an established free one.de:MIDlet