Thursday, January 7, 2010

How to get device IMEI number using JavaME for different vendors?

The International Mobile Equipment Identity (IMEI) is a number unique to every GSM, WCDMA, and iDEN mobile phone, as well as some satellite phones. It is usually found printed inside the battery compartment of the phone. It can also be displayed on the screen of the phone by entering *#06# into the keypad on most phones.

To retreive same information using JavaME is as follows:
As you all know that, MIDP (Mobile Information Device Profile) when combined with CLDC provides a Java Runtime Environment and a rich set of Java APIS for cell phones. MIDP defines some System properties that are available to the midlet with  java.lang.System.getProperty(...) method. As IMEI is manufacturer specifc so there are few manufacturer specific APIs using which you can retrieve this info. Here's how to get IMEI number from mobile devices of different manufacturers:
  1. Nokia
    • System.getProperty("phone.imei");
    • System.getProperty("com.nokia.imei");
    • System.getProperty("com.nokia.mid.imei"); //especially for S40  devices
    Note: Requires signed MIDlet. S60 3rd edition device does not requires signing to fetch this info.On Series 40 phones this requires that your MIDlet is signed to either operator or manufacturer domain, and this is only available in Series 40 3rd Edition, FP1 devices and newer.
  2. Sony Ericsson
    • System.getProperty("com.sonyericsson.imei");
  3. Samsung
    • System.getProperty("com.samsung.imei");
  4. Motorola
    • System.getProperty("IMEI");
    • System.getProperty("com.motorola.IMEI");
  5. Siemens
    • System.getProperty("com.siemens.IMEI");
  6.  LG
    • System.getProperty("com.lge.imei");
In addition to this, there are some generic information about the device that can be retrieved by using System.getProperty(propertyString) method call, where value of propertyString can be vary as per your requirement. Few of them are listed as below:-
  1. microedition.profiles
  2. microedition.configuration
  3. microedition.locale
  4. microedition.platform