Archive for category J2ME

How to connect to a .NET Web Service from a J2ME MIDlet using kSOAP 2

Web services had and continue to have a great impact on the development of Web applications because they allow total independence between clients and service providers. The location, the platform, the programming language and the architecture of both the clients and the services has no effect on each other. The Internet technologies and standards that allowed the implementation of Web services are HyperText Transfer Protocol (HTTP), eXtensible Markup Language (XML), Remote Procedure Call (RPC), Web Services Description Language (WSDL), Simple Object Access Protocol (SOAP) and Universal Description, Discovery, & Integration (UDDI).

In this article we will see how to connect to a .NET Web Service from a j2ME MIDlet using kSOAP2 library. The Java 2 Micro Edition (J2ME) Platform offers support for Web Services through the J2ME Web Services API (WSA), JSR 172, which provides two optional APIs: remote service invocation (JAX-RPC) and XML parsing (JAXP). For the next example, we will use the third party kSOAP 2 library because it is lightweight and efficient. The solution is developed in the NetBeans IDE but you could use also Eclipse IDE.

Read the rest of this entry »

, ,

8 Comments

J2ME tutorial – How to create and display forms and alerts

J2ME mobile applications are simple solutions that allow users to manage their data using different controls that are placed in forms, windows or Displayable. In the J2ME API, the equivalent of desktop applications windows is represented by a relative reduced set of forms which are subclasses of Displayable class. The entire framework is a limited, smaller set of classes which are easy to use and less demanding of memory and processor resources than the desktop counterpart as Java AWT (Abstract Window Toolkit) or Swing.

Read the rest of this entry »

2 Comments

How to encrypt with 3DES – DESede from Bouncy Castle API in J2ME applications

In this post we will see how to use the 3DES (Triple Data Encryption Standard in EDE mode) or DESede algorithm implementation from the Bouncy Castle API for J2ME platform. The example will use the 3DES lightweight engine to encrypt and decrypt a file managed by a J2ME (MIDlet) application.

The Bouncy Castle Crypto API for Java provides a lightweight cryptographic API that works with everything from the J2ME to the JDK 1.6 platform. The API is different for J2ME platform than the one for JDK platform. For example, the lightweight API has different implementations for the two platforms:

Read the rest of this entry »

, , , , ,

3 Comments

How to encrypt / decrypt with DES from JSR 177 SATSA API in J2ME applications

In this post we will see how to use the DES (Data Encryption Standard) algorithm implementation, in CBC and ECB modes, from the Security and Trust Services API (SATSA) for J2ME platform. The complete example will use the DES engine (in CBC or ECB mode) to encrypt and decrypt a file managed by a J2ME (Midlet) application.

The Security and Trust Services API (SATSA) specification defines optional packages for the Java 2 Platform, Micro Edition (J2ME) and is a lightweight cryptographic version of the standard version in JSE. The API is different for J2ME platform than the one for JDK platform because it provides fewer classes. Regarding the API, both the J2ME and JSE platforms use Cipher as the main class for cryptographic algorithms.

Read the rest of this entry »

, ,

2 Comments

How to use GPS location services and Google Static Map API in J2ME MIDlets

Today, most mobile devices come with a GPS module or can connect to one using Bluetooth services. These devices come with support for the Location API for J2ME under JSR-179 that allow J2ME MIDlets applications to query the GPS module for geo-location coordinates. Also mobile applications integrate location based services and one increasingly used it to provide maps images using Google Maps or Google Static Maps. The later is accessible through Google Static Maps API V2, which is an open and free service (no longer requires a Maps API key) and more efficient as it minimizes network transfers.

In this article it is described and developed a fully MIDlet application that gets coordinates from the mobile device GPS module and use them to display a Google static map for that location. The application can be tested on the emulator or on a real device that has a GPS module incorporated.
Read the rest of this entry »

, , ,

8 Comments

How to use kXML to parse XML files in J2ME projects

kXML is a small XML pull parser, specially designed for constrained environments such as Applets, Personal Java or MIDP devices.

The problem for J2ME MIDlets is that there are mobile devices that don’t support the XML API for Java ME additional package (JSR 280). In order to solve this problem, we need an independent and lightweight XML parser that must be fast and with a small impact on the memory. Two possible solutions are kXML and NanoXML.

Read the rest of this entry »

,

4 Comments

How to parse XML, RSS feed with kXML in a J2ME MIDlet

More an more mobile devices are used to access Internet and connected services. One efficient way to transfer data between different platforms and technologies is to use XML files, which are simple text files formatted accordingly to the XML rules.

IN order to process an XML file and to extract needed data you need a XML parser which is a text process engine.

Read the rest of this entry »

, ,

7 Comments

J2ME tutorial – How to create a simple MIDlet application with NetBeans

The purpose of this tutorial is to present the basic elements needed for mobile Java applications (MIDlets) development. The notions described will be sufficient to build a simple application J2ME HelloWorld application.

Read the rest of this entry »

27 Comments

How to encrypt / decrypt with AES from Bouncy Castle API in J2ME applications

In this post we will see how to use the AES (Advanced Encryption Standard) or Rijndael algorithm implementation from the Bouncy Castle API for J2ME platform. The example will use the AES lightweight engine to encrypt and decrypt a file managed by a J2ME (Midlet) application.

The Bouncy Castle Crypto API for Java provides a lightweight cryptographic API that works with everything from the J2ME to the JDK 1.6 platform.

The API is different for J2ME platform than the one for JDK platform. For example, the lightweight API has different implementations for the two platforms:

Read the rest of this entry »

, , , ,

19 Comments

How to use Bouncy Castle Lightweight Cryptographic API in NetBeans for J2ME (midlets) projects

The Bouncy Castle Crypto API for Java provides a lightweight cryptography API that works with everything from the J2ME to the JDK 1.6 platform.

The API provides cryptographic functions for Java JDK 1.1 to 1.6 applications and for J2ME (mobile applications) midlets. The API can be downloaded from the Bouncy Castle latest releases page. Read the rest of this entry »

, , ,

13 Comments