8

How to get the IMEI of a Java ME device in a common way that is applicable to all devices

4 Answers 4

6

Usually, using java.lang.System.getProperty() can return the device IMEI.

Unfortunately, the String parameter you need to use to get the IMEI will change from one handset manufacturer to the next.

Strings to try:

imei
phone.imei
com.lge.imei
com.nokia.imei
com.nokia.mid.imei
com.siemens.imei
com.sonyericsson.imei
com.motorola.imei
...
you get the idea.

you may need to uppercase the last part of the string.

the format of the result can change too.
it can be a full imei with a "IMEI" prefix and 3 "-" in the middle of 17 digits.
it can be a normalized imei of 13 or 15 digits...

1
  • I have tried all 8 Strings but I always get Null, is there a complete reference or library that can do that and run on any mobile ???? May 9, 2012 at 11:32
3

there is no standard way to get the IMEI via Java ME. some phones expose the IMEI as a system property, but others don't or require the midlet to be signed to operator or manufacturer domain (ie. not by you).

2

In the game i'm developing, to get an unique id for every cellphone (so that they can't duplicate and share savefiles) i use the bluetooth mac address that is different for every single bluetooth device and the java code to get it is the same on every device =D

1
  • 2
    Thanks Ricardo, however you need the JSRs that support bluetooth on that phone
    – Prabhu R
    Oct 30, 2009 at 7:59
0

I have tried what is suggested by both ax and quickrecipeonsymbianos however they both solve the purpose in an elegant way. However, in the BlackBerry we have the getDeviceID() to get the unique id of the device, but Java ME lacks this functionality

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.