Getting IMEI and IMSI in Java ME
Article Metadata
Importance of IMEI and IMSI : The IMEI and IMSI can be used to ensure extra security while user make use of your application For e.g if you want manager should access his account from valid phone provided by organization.This two codes can be proven effective.
The code will work in almost all devices.
public String getIMEI() {
String out = "";
try {
out = System.getProperty("com.imei");
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("phone.imei");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("com.nokia.IMEI");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("com.nokia.mid.imei");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("com.sonyericsson.imei");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("IMEI");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("com.motorola.IMEI");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("com.samsung.imei");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("com.siemens.imei");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("imei");
}
} catch (Exception e) {
return out == null ? "" : out;
}
return out == null ? "" : out;
}
//code for getting IMSI of the phone
public String getIMSI() {
String out = "";
try {
out = System.getProperty("IMSI");
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("phone.imsi");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("com.nokia.mid.mobinfo.IMSI");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("com.nokia.mid.imsi");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("IMSI");
}
if (out == null || out.equals("null") || out.equals("")) {
out = System.getProperty("imsi");
}
} catch (Exception e) {
return out == null ? "" : out;
}
return out == null ? "" : out;
}


Mohammad kaied -
Should we use any Library? or API Permission
I tested it on Nokia N95 and N73 nothing shownmohammad_kaied 17:25, 25 July 2011 (EEST)
PiyushAgnihotri - to Get IMEI No
We are getting 14 Digit IMEI No, instead of 15 digitPiyushAgnihotri 14:34, 5 April 2013 (EEST)
Hamishwillee - Suggest you raise on the discussion boards
... providing link to dibo here and back to here from dibo. Also provide information on what device you are using to test this.
Regards
Hamishhamishwillee 09:01, 17 April 2013 (EEST)