Namespaces
Variants
Actions

Getting IMEI and IMSI in Java ME

Jump to: navigation, search
SignpostIcon MobilePhone 52.png
Article Metadata

Article
Created: prssupe (09 May 2011)
Last edited: hamishwillee (05 Jul 2012)

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;
}
This page was last modified on 5 July 2012, at 08:36.
231 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved