Mobile
[Mobile] IMEI Java ME에서 가져오기
Thë 굽은ㄴr무™
2013. 6. 25. 10:35
출처 : http://www.developer.nokia.com/Community/Wiki/Getting_IMEI_and_IMSI_in_Java_ME
Getting IMEI and IMSI in Java ME
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; } |