Data Management</li></li></ul><li>Different Approaches…<br />Blackberry Browser<br />Ease of development and deployement<br />Reduced Flexibility<br />Java Application<br /><ul><li>Ultimate Flexibility
Longer development and deployement</li></li></ul><li><ul><li>The BlackBerry® Java Development Environment (JDE) provides a complete set of APIs and tools for you to develop Java applications that run on BlackBerry Wireless Handhelds.
include a J2ME runtime environment that is based on the CLDC 1.1 and MIDP 2.0 specifications. </li></ul>MIDP Java Application<br />Custom BB App<br />MIDP<br />Blackberry API<br />CLDC<br />JVM<br />
Application Manager<br /><ul><li>VM loads an application manager, which manages all Java applications on the handheld. The application manager functions as the central dispatcher of operating system events for other Java applications.
Applications that provide a user interface extend the net.rim.device.api.ui.UiApplicationclass. This class provides methods for applications to register event listeners, manage threads, and manage UI components.
When the application manager receives an event, it copies the event to the appropriate queues, which enables the application manager to direct messages to certain programs. For example, only the foreground application receives user input messages.
Extending MainScreen class/Screen</li></li></ul><li>Event Listener<br /><ul><li>Event listener interfaces are divided by event type. Each application registers toreceivespecific types of events.
The application.s event queue then dispatches events to the appropriate listeners.
Applications can implement the appropriate listener interfaces or override the listener methods on the various Screen objects. Most applications implement the KeyListener and TrackwheelListener interfaces and register the listeners to receive keyboard and trackwheelevents.</li></li></ul><li>Threads<br /><ul><li>An application can access the UI only on the event thread, or with the event lock held.Onlyone thread at a time (usually the event-dispatching thread) can gain access to an interface component.
Background threads can access the UI from outside the main event-handling or UI drawing code in two ways:</li></ul>acquire and hold the event lock<br />use invokeLater() or invokeAndWait() to run on the event dispatch thread<br /><ul><li>The BlackBerry Java environment provides a true multithreading environment for running applications. This enables multiple applications to run simultaneously, events to broadcast to multiple applications, and long operations or listener threads to run in the background.</li></li></ul><li>Network Communication<br /><ul><li>The BlackBerry JDE provides the following connection types: </li></ul>stream connections (StreamConnection interface), including:<br />HTTP connections (HttpConnection interface)<br />HTTPS connections (HttpsConnection interface)<br />socket connections (SocketConnection interface)<br />secure socket connections (SecureConnection interface)<br />serial connections to a communication port on the handheld (CommConnection interface)<br />datagram connections (DatagramConnection interface), including:<br /><ul><li>UDP datagram connections (UDPDatagramConnection interface)</li></li></ul><li>Data Management<br /><ul><li>The BlackBerry Persistent Store APIs and the MIDP RMS APIs (support for JSR 37 and JSR 118) are available on all Java® based BlackBerry devices.
The BlackBerry® Persistent Store APIs are designed to provide a flexible and robust data storage interface. With the BlackBerry Persistent Store APIs, you can save entire Java® objects to memory without having to serialize the data first. When you start the application, you can retrieve the Java object from memory and process the information
However the limit for an individual object within the store is 64 KB.
The RMS APIs provide a simple record management system that allows you to create a data store object and persist a series of records within that object. Each record is a byte array, so you must first serialize your data into a byte array format before storing it locally.</li></li></ul><li>Memory Management<br /><ul><li>The BlackBerry® Java® Virtual Machine manages memory usage on the BlackBerry device. The BlackBerry JVM allocates memory, performs garbage collection, and automatically swaps data between SRAM and flash memory.
The BlackBerry JVM must also share available memory between the BlackBerry device applications and the BlackBerry® Java Application.
The memory capabilities represent the total amount of available memory, which is larger than the available working memory when all of the applications and associated application data exist on the BlackBerry device.
Advantages of BlackBerry Development<br />BlackBerry provides various advantages to create a robust and world class applications:-<br /><ul><li> Can use two software platforms to develop applications: Java Platform, Micro Edition (J2ME) and MDS.
J2ME enables most feature-rich and functionality based solutions
Java application development gives ultimate flexibility, power and control.</li></li></ul><li>Basic UI Architecture<br /><ul><li>3 Main Classes:
Screen</li></ul>Main Manager<br /><ul><li>The BlackBerry UI framework uses Manager objects to contain fields. Various Manager subclasses, such as VerticalFieldManager, manage specific kinds of field layouts.
MainScreen typically uses a top-level VerticalFieldManagerto manage and lay out other fields, including other field managers.</li></li></ul><li>Basic UI Architecture<br />Fields<br /><ul><li>UI components
The field sizes itself according to its layout requirements.</li></ul>Screen<br /><ul><li>Each UI application maintains a stack of Screen objects.
Each Screen object has a</li></ul>delegate manager, the single Manager object directly controlled by the Screen to manage layout and scrolling for the entire screen.<br />
Blackberry Java Environment<br /><ul><li>As in any standard Java environment, source files for BlackBerry applications are compiled into Java bytecode by a Java compiler. This bytecode is loaded onto the handheld and run by the Java virtual machine (VM), which translates the Javabytecodeinto instructions that the processor can understand.
Main 2 diff b/w Std. Java environment and BB Environment:
The BlackBerry Java environment uses smaller, more efficient bytecode that is designed for transmission over low-bandwidth networks and storage on small handhelds. Source files are compiled into handheld code files
The BlackBerry Java environment uses an optimized virtual machine instead of the standard KVM provided as part of the CLDC specification. For this reason, you must use the IDE to convert MIDlet applications (.jar and .jad files) to run on the BlackBerry handheld.</li></li></ul><li>Blackberry Java Environment<br />Restrictions :<br />The BlackBerry Wireless Handheld VM has the following restrictions, as specified by CLDC 1.1:<br />no object finalization<br />no java.lang.Error class hierarchy<br />no user class loading<br />no reflection, therefore no support for Remote Method Invocation (RMI) or Jini. network technology<br />no native methods<br />no Runtime.exec() for running external processes<br />