blackberry development environment
DESCRIPTION
Gives you an overview of Development Environment for BB.TRANSCRIPT
Development Environment
Predhin Tom Sapru
Introduction
• Application Manager• Event listeners• Threads
• Network Communication• Memory Management• Data Management
Different Approaches…
Blackberry Browser– Ease of development and deployement– Reduced Flexibility
Java Application• Ultimate Flexibility• Longer development and deployement
• 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.
MIDP Java Application
MIDP
CLDC
JVM
Blackberry API
Custom BB App
Application Manager• 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.UiApplication class. 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.
• Define Screen to be pushed• Extending MainScreen class/Screen
Event Listener
• Event listener interfaces are divided by event type. Each application registers toreceive specific 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 trackwheel events.
Threads• An application can access the UI only on the event
thread, or with the event lock held.Only one 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:
1. acquire and hold the event lock2. use invokeLater() or invokeAndWait() to run on the
event dispatch thread• 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.
Network Communication
• The BlackBerry JDE provides the following connection types:
1. stream connections (StreamConnection interface), including:
2. HTTP connections (HttpConnection interface)3. HTTPS connections (HttpsConnection
interface)4. socket connections (SocketConnection
interface)5. secure socket connections (SecureConnection
interface)6. serial connections to a communication port
on the handheld (CommConnection interface)7. datagram connections (DatagramConnection
interface), including:• UDP datagram connections
(UDPDatagramConnection interface)
Data Management
• 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.
Memory Management
• 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.
• Types: Flash, SRAM, microSD expandible memory card
Blackberry Infrastructure
Advantages of BlackBerry Development
BlackBerry provides various advantages to create a robust and world class applications:-
• 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.
• 3 Main Classes:• Field• Manager • Screen
Basic UI Architecture
Main Manager• 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 VerticalFieldManager to manage and lay out other fields, including other field managers.
Basic UI Architecture
Fields• UI components• The field sizes itself according to its
layout requirements.Screen• Each UI application maintains a
stack of Screen objects.• Each Screen object has adelegate manager, the single Manager object directly controlled by the Screen to manage layout and scrolling for the entire screen.
• 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 Javabytecode into 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.
Blackberry Java Environment
Restrictions :1. The BlackBerry Wireless Handheld VM has the
following restrictions, as specified by CLDC 1.1:2. no object finalization3. no java.lang.Error class hierarchy4. no user class loading5. no reflection, therefore no support for Remote
Method Invocation (RMI) or Jini. network technology
6. no native methods7. no Runtime.exec() for running external
processes
Blackberry Java Environment
Thank You