Skip to main content

NEED HELP!! how to Display IMEI number on Java ME emulator device

2 replies [Last post]
zai87
Offline
Joined: 2009-06-30
Points: 0

Hi all..
i'm doing my final project for my degree.. the problem that i face is about displaying an IMEI number on Java ME emulator device.

i found the code from http://www.java-forums.org. but its not working though i have change some values inside System.getProperty

does anyone have an idea on this? your help will be highly appreciated dude.. thanks a lot
below is the code:

import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;

public class IMEI extends MIDlet implements CommandListener {
private Display mDisplay;
private Form mTestForm, mForm2;
private Command mCMD_EXIT,mSend;
private TextField mText,mText1,mText2, mText3;
private List implicitList;

public void startApp(){
mCMD_EXIT = new Command("Exit", Command.EXIT, 1);
mSend = new Command("Send", Command.SCREEN,1);

mText = new TextField("IMEI :", "", 15, TextField.NUMERIC);
mText1 = new TextField("Model :", "", 5, TextField.ANY);
mText2 = new TextField("County :", "", 17, TextField.INITIAL_CAPS_WORD);
mText3 = new TextField("Retail ID:", "", 10, TextField.NUMERIC);

//retrieve the IMEI and display
mText.setString(System.getProperty("phone.imei"));

mTestForm = new Form("IMEI WARRANTY");
mTestForm.addCommand(mCMD_EXIT);
mTestForm.addCommand(mSend);

mTestForm.append(mText);
mTestForm.append(mText1);
mTestForm.append(mText2);
mTestForm.append(mText3);

mTestForm.setCommandListener(this);
mDisplay = Display.getDisplay(this);
mDisplay.setCurrent(mTestForm);

}
public void commandAction(Command c, Displayable s){
if (c.getCommandType() == Command.EXIT){

notifyDestroyed();
}
else if(c == mSend){

mDisplay.setCurrent(mForm2);
mForm2.setCommandListener(this);

}

}

public void pauseApp(){

}

public void destroyApp(boolean unconditional){}
}

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
sfitzjava
Offline
Joined: 2003-06-15
Points: 0

It differs between devices. See this article:
http://mobilepit.com/10/how-to-get-imei-number-in-j2me-javame.html

Also this sample code may help you find the correct value:
http://www.forum.nokia.com/info/sw.nokia.com/id/37086440-dcce-4fb4-aa3e-...

You might try:
System.getProperty("microedition.phone.imei")
or
System.getProperty("IMEI")

-Shawn

zai87
Offline
Joined: 2009-06-30
Points: 0

thanks for the information. :)