View RSS Feed

Java ME

Java Micro Edition

  1. OMA standard for data synchronisation - SyncML

    by , 11-28-2011 at 07:06 PM (My Java Tips)
    SyncML is the standard for data synchronization and is accepted by Open Mobile Alliance (OMA). All the major players, including Ericsson, Nokia, IBM, Motorola, and Symbian support this protocol.


    The synchronization of data has great importance in today’s world. You carry email applications, contact database, files and other stuff on your handheld devices. It would be great of you can synchronize those with your desktop/notebook. For that there has to be a agreed format.
    ...
    Tags: oma, syncml Add / Edit Tags
    Categories
    Java ME
  2. Writing MIDlet for SMS

    by , 11-27-2011 at 05:53 PM (My Java Tips)
    SMS stands for Short Messaging Service and it is very common in mobile communication. J2ME provides an API for SMS which makes messaging very easy.


    I will write a MIDlet to show how to create a messaging system using javax.wireless.messaging.
    First step is to import all the required APIs:

    Java Code:
    import javax.microedition.midlet.*;
    import javax.microedition.io.*;
    import javax.microedition.lcdui.*;
    import javax.wireless.messaging.*;
    ...
    Tags: api, midletj2me, sms Add / Edit Tags
    Categories
    Java ME
  3. MIDlet Suite

    by , 11-27-2011 at 05:44 PM (My Java Tips)
    In this post, I will introduce you to the MIDlet suite.


    I assume that you people have worked with Eclipse. In Eclipse, you create projects and all the contents of the project are placed in the project folder. It is an approach for managing the work.

    MIDlet suite is very much like a standard Java project in Eclipse. Please note that it's not a requirement to place MIDlets inside a Java Archive (JAR) file, but JAR files provide the most common means of distributing MIDP ...
    Categories
    Java ME
  4. Deploying MIDlets onto Mobile Devices

    by , 11-26-2011 at 06:43 PM (My Java Tips)
    The subject topic is very interesting and a lot of people have asked me about this. It is just a matter of knowing how this works. I am sure you will find it very interesting.


    MIDlets are programmed using Java Development environments like Eclipse, JBuilder,Netbeans or Sun Java wireless Toolkit. Once coded, they are build and tested on emulators. When all the tests are passed, you want to finally deploy it to your mobile device to see how it works in real world scenerio.
    ...
    Categories
    Java ME
  5. Record Management System

    by , 11-22-2011 at 06:14 PM (My Java Tips)
    RMS is a database (flat file) which MIDlets can use to persist data. In this post, I will introduce the audience with RMS.


    The device platform maintains the integrity of the MIDlet's record stores throughout the normal use. The reboots, battery changes, etc. won’t affect the RMS. An interesting question developers ask is, where is this Record Store created? It is created at platformdependent location, like nonvolatile device memory, and is not directly exposed to the MIDlets.
    ...
    Tags: midlet, rms, timestamp Add / Edit Tags
    Categories
    Java ME
  6. TextField vs TextBox

    by , 11-22-2011 at 06:08 PM (My Java Tips)
    javax.microedition.lcdui provides TextField and TextBox which are sometimes confusing. Both are to allow the user to enter text, but question arises, when to use which one? In this post, I will try to address this issue.


    Let me first explain TextField (javax.microedition.lcdui.TextField). This class inherits from javax.microedition.lcdui.Item, so you should know that its an item that can be placed on a form. To create an instance of TextField, we use the TextField constructor: ...
    Categories
    Java ME
  7. Jsr 75

    by , 11-22-2011 at 05:52 PM (My Java Tips)
    JSR 75 specifies 2 optional packages for mobile devices. I will be talking about these in the next few posts.


    The two provided packages are:
    Java Code:
    javax.microedition.io.file
    javax.microedition.pim
    PIM stands for personal information and it contains following information:
    - contact list
    - todo list
    - events

    If you want to access these from a J2ME application, then javax.microedition.pim is to be used.

    ...
    Tags: j2me, jsr 75, pim Add / Edit Tags
    Categories
    Java ME
  8. Reading/writing files

    by , 11-22-2011 at 05:26 PM (My Java Tips)
    This post is all about reading and writing text files on mobile device.


    In order to write files on the mobile device, you need com.motorola.file.writeaccess. If your application has that permission, you can write files easily using the following code.

    Java Code:
    FileConnection sc = (FileConnection)Connector.open("file:///phone/tmp.txt");
    OutputStream os = sc.openOutputStream();
    os.write(("text to go into the file").getBytes());
    ...
  9. Sending SMS (snippet)

    by , 11-22-2011 at 05:22 PM (My Java Tips)
    This post presents a snippet for sending short text messages from J2Me applications.


    The com.sun.midp.io.j2me.sms package provides an API for the Short Message Service Messaging system and allows MIDlet to access SMS functionality on a GSM mobile device. You need javax.wireless.messaging.sms.send premission to send SMS messages from your J2ME application. The sample code is presented below:

    Java Code:
    sender = (MessageConnection)Connector.open("sms://");
    ...
  10. GPS location / Cell id / Placing a call

    by , 11-22-2011 at 05:16 PM (My Java Tips)
    This post presents miscellaneous tasks that you can do in your J2ME application.


    Firstly, how to get GPS location. javax.microedition.location.Location provides support for this. Review the snippet below:

    Java Code:
    LocationProvider loc = LocationProvider.getInstance(null);
    loc.setLocationListener(ll,0,-1,-1);
    Location location = loc.getLocation(60*3);
    String lat = location.getQualifiedCoordinates().getLatitude();
    String lon = location.getQualifiedCoordinates().getLongitude();
    ...
  11. MIDP packages

    by , 11-22-2011 at 04:53 PM (My Java Tips)
    MIDP provides a standard run-time environment that allows new applications and services to be deployed dynamically on end-user devices like cellular phones and pagers. The MIDP is built upon CLDC (Connected Limited Device Configuration).


    MIDP is an industry-standard profile for mobile devices and it is not dependent on a specific vendor. It is a provides foundation for mobile application development. MIDP contains following 3 core CLDC packages:

    java.lang
    java.io ...
  12. Sync4J

    by , 11-07-2011 at 06:49 PM (My Java Tips)
    To create an implementation of SyncML protocol, you may use sync4j. I will introduce you to sync4j in this post.



    You may download it from:
    http://sync4j.sourceforge.net.

    Sync4j possesses layered architecture and the layers are:

    Core layer - The actual SyncML handling is done by the core layer. Its responsibilities include XML parsing and conversion of the SyncML markup to an internal object representation. Sync4j can also convert internal ...
    Categories
    Java ME , XML
  13. in.use file

    by , 11-07-2011 at 06:17 PM (My Java Tips)
    A lot of J2ME developers face problems when running multiple instance of Nokia Wireless Toolkit emulators. Some of the problems are linked with in.use file. This post is all about that.


    When your run the emulator, a file named in.use is created in the emulator’s root directory with will be something like:

    ..\j2mewtk\2.5.2\appdb\DefaultColorPhone\

    This file is removed when the emulator shuts down.

    This emulator’s default directory will also ...
    Categories
    Java ME
  14. RecordStore with examples

    by , 11-07-2011 at 06:15 PM (My Java Tips)
    I will use several examples to show how to use RecordStrore in J2ME applications.


    Creating record store is simple. We use a static method to create or open an existing record store.

    Java Code:
    public static RecordStore openRecordStore(String recordStoreName,
                                              boolean createIfNecessary)
                                       throws RecordStoreException,
                                              RecordStoreFullException,
    ...
    Categories
    Java ME
  15. Short Message Peer to Peer protocol

    by , 11-07-2011 at 05:14 PM (My Java Tips)
    SMPP is a communication protocol designed for transfer of short messages between short message centre and SMS application.


    Some useful points about SMPP are listed below:

    - Binary encoded protocol data units are exchanged in request and response.
    - Transceiver support is added in version 2.4, which allows a single connection to send and receive messages.
    - Data exchange can be synchronous or a synchronous.

    External Short Message Entities ...
    Categories
    Java ME
  16. Fetching contact field (PIM)

    by , 11-06-2011 at 06:07 PM (My Java Tips)
    Each contact entry in a PIM Contact database is represented by Contact. This post is all about retrieving contact fields from PIM.


    The supported field list for a Contact depends on vCard specification from the Internet Mail Consortium. These set of fields included in this Contact class provides relevant information about a contact. ContactList restricts what fields a Contact can retain. This reflects that some native Contact databases do not support all o the fields available in a ...
    Categories
    Java ME
  17. PIM - ToDo

    by , 11-06-2011 at 06:04 PM (My Java Tips)
    javax.microedition.pim.ToDo is an interface that extends from PIMItem. It represents a single ToDo item in a PIMToDo database. I will present an example of how to retrieve ToDo list from PIM.


    Consider the following example. We create todos with fields of our interest. But before adding the field,w e should check if its supported on the platform or not.

    Java Code:
    ToDoList todos = null;
     try {
        todos = (ToDoList) PIM.getInstance().openPIMList(PIM.TODO_LIST,
    ...
    Categories
    Java ME
  18. Converting an existing project to an EclipseME project

    by , 11-03-2011 at 06:32 PM (My Java Tips)
    Eclipse provides ‘Convert to J2ME Midlet Suite’ from the project pop-up menu to convert an existing Java project to EclipseME project. Let me show how to do that.


    When you select ‘Convert to J2ME Midlet Suite’’, you will be prompted for the appropriate device definition by the EclipseME plug-in. This plugin will then make the required changes to your project.

    When you convert a J2SE project to an EclipseME project, the J2SE libraries have to to be removed from the build ...
    Categories
    Eclipse , Java ME
  19. Creating J2ME MIDlet Project

    by , 11-03-2011 at 06:31 PM (My Java Tips)
    Many guys who are new to mobile application development often question: “Does Eclipse support MIDlet development?”. Yes it does. In the next few posts, I will explain how you can create a J2ME project in Eclipse.


    To cleate a EclipseME project, we should use the New Project Wizard and select J2ME Midlet Suite from within the J2ME item.

    Name:  j2me_midlet_suite.PNG
Views: 408
Size:  9.8 KB

    You will then see a wizard pane which is actually the standard for almost all Eclipse projects. ...
    Categories
    Java ME , Eclipse
  20. The Thread Class

    by , 10-29-2011 at 07:29 PM (My Java Tips)
    java.lang.Thread is used to create and control threads. A new instance of this class must be created to use a new thread. Once a thread is created, it does not start running right away. Thread.start() must be called to actually make the thread run. On calling Thread.start(), the thread begins executing in the run() method of the target class.


    Remember that a new Thread class always starts running the public void run() method of a class. There are two ways to create a thread:
    ...

    Updated 10-29-2011 at 07:32 PM by Java Tip

    Categories
    Java ME , Java SE