IT tutorials
 
Mobile
 

Fundamentals of Java ME MIDP Programming : Non-GUI APIs in MIDP

10/11/2011 3:15:09 PM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
In this section, we cover in more detail the MIDP APIs not related to GUI development. Focus here is given to the persistent data, Media, Networking and Push Registry APIs.

1. Record Management System

MIDP provides a simple record-based persistent storage mechanism known as the Record Management System (RMS). It's a package that allows the MIDlet application to store persistent data within a controlled environment, while maintaining system security. It provides a simple, non-volatile data store for MIDlets while they are not running. The classes making up the RMS are contained in the javax.microedition.rms package.

Essentially, the RMS is a very small, basic database. It stores binary data in a Record within a RecordStore. MIDlets can add, remove and update the records in a RecordStore. The persistent data storage location is implementation-dependent and is not exposed to the MIDlet. A RecordStore is, by default, accessible across all MIDlets within a suite, and MIDP extends access to MIDlets with the correct access permissions from other MIDlet suites. When the parent MIDlet suite is removed from the device, its record stores are also removed, regardless of whether a MIDlet in another suite is making use of them.

Here is a short example of how to use RMS for writing and reading persistent data from the device:

// saving data to RMS
public int saveToStore(byte[] data) {
int recordID = 0;
try {
RecordStore store = RecordStore.openRecordStore("ImageStore", true);
recordID = store.addRecord(data, 0, data.length);
store.closeRecordStore();
}
catch(RecordStoreException rse) {
rse.printStackTrace();
}
return recordID;
}
// reading data from RMS
public byte[] loadFromStore(String storeName, int recordID) {
byte[] data = null;
try {
RecordStore store = RecordStore.openRecordStore("ImageStore", false);
data = store.getRecord(recordID);
store.closeRecordStore();
}
catch(RecordStoreException rse) {
rse.printStackTrace();
}
return data;
}


2. Media API

MIDP includes the Media API which provides limited, audio-only multimedia. It is a subset of the optional and much richer JSR-135 Mobile Media API, which currently ships on most Symbian OS phones.

The MIDP Media API provides support for tone generation and audio playback of WAV files if the latter is supported by the underlying hardware. Since MIDP is targeted at the widest possible range of devices, not just feature-rich smartphones, the aim of the Media API is to provide a lowest common denominator of functionality suitable for the capabilities of all MIDP devices.

3. Networking – Generic Connection Framework

CLDC has defined a streamlined approach to networking, known as the Generic Connection Framework (GCF). The framework seeks to provide a consistent interface for every network connection between the MIDP classes and the underlying network protocols. It doesn't matter what kind of connection is being opened; the interface remains the same. For instance, if you're opening a socket or an HTTP connection, you are still going to use the same Connector.open() method. MIDP has support for many protocols, although HTTP and HTTPS are mandatory. Java ME on Symbian OS also supports other optional protocols, such as sockets, server sockets and datagrams.

4. Push Registry

The Push Registry API allows MIDlets to be launched in response to incoming network connections. Many applications, particularly messaging applications, need to be continuously listening for incoming messages. To achieve this in the past, a Java application would have had to be continually running in the background. Although the listening Java application may itself be small, it would still require an instance of the virtual machine to be running, thus appropriating some of the mobile phone's scarce resources. The JSR-118 group recognized the need for an alternative, more resource-effective solution for MIDP and so introduced the Push Registry.
 
Others
 
- iPad : Advanced Wi-Fi Options (Hidden or Undiscoverable Networks)
- iPad : Wi-Fi Connections
- Beginning Android 3 : Install the ADT for Eclipse & Install Apache Ant
- Install the Android SDK
- The Anatomy of a Mobile Site : Site structure and concepts (part 2) - Entry Points and URLs
- The Anatomy of a Mobile Site : Site structure and concepts (part 1) - Information Architecture
- Using Visual Studio for Windows Phone Development (part 2)
- Using Visual Studio for Windows Phone Development (part 1)
- Windows Phone and .NET : Windows Phone Platform
- Introducing the iPhone SDK (part 5) - Programming Paradigms
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us