Memory and real estate defines Java midlets
- 12 March, 2001 11:14
Storage, the user interface, and the tradeoff between portability and tight access to native device features -- these are some of the issues developers have to contend with when writing applications for mobile devices.
In the Java 2 Micro Edition (J2ME), these considerations are handled by the mobile Internet device profile (MIDP), which defines the application programming interfaces (APIs) for mobile devices, said Steve Ritter, technology evangelist at Sun Microsystems Inc. Ritter was speaking at Sun's TechDays developer conference in Singapore last week.
J2ME is aimed at devices with less power than the standard PC, such as mobile phones, PDAs (personal digital assistants) and the digital set top boxes for televisions. Under J2ME, configurations and profiles have been created to incorporate both device-specific APIs and standard Java class libraries.
The MIDP -- the programs are called Midlets -- is targeted at devices within a specific memory range: the implementation must fit in a small footprint of 128K bytes of memory, and be able to run on a low-end processors, said Ritter.
Among other things, the MIDP specifies how data is stored in mobile devices. "There is no hierarchical file system on a mobile phone," Ritter pointed out. "Instead, there is a lightweight record-oriented database, and each record is essentially an array of bytes with a unique identifier."
Another important consideration for mobile applications is the user interface. The majority of mobile devices are one-hand operated, and have small screens, Ritter said. And not all of them have pointing devices.
Under the MIDP, the user interface is split into two layers. A higher-level API is aimed at applications that require maximum portability, and do not have access to the underlying native device features. The low-level API is targeted at applications that require close access to hardware. Ritter cited the example of gaming applications, which require access to key strokes and display features.
"However, when you use low-level APIs, you sacrifice portability," he pointed out.
The profiles defined by the MIDP sit on top of the connected limited device configuration (CLDC), one of two configurations defined by Sun, the other being the connected device configuration or CDC.
The configurations are specified based on memory because that quantifies how much can be squeezed into a device, said Ritter. The CLDC includes the definition of the Java virtual machine for mobile devices. The Java virtual machine is a self-contained operating environment that is separate from the host operating system. This enables Java programs to run the same way, regardless of the underlying hardware or software.