/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package main;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.io.UnsupportedEncodingException;
/**
* @author shangweituo
*/
public class IMEI extends MIDlet {
private Form form;
String imei = "";
String cellid = "";
String lac= "";
String mnc = "";
String send = "";
public IMEI()
{
try
{
try{
imei = System.getProperty("com.nokia.mid.imei");
}catch(Exception ex1)
{
imei = "";
}
if (imei == null || "".equals(imei)) {
try{
imei = System.getProperty("com.nokia.IMEI");
}catch(Exception ex1)
{
imei = "";
}
}
if (imei == null || "".equals(imei)) {
try{
imei = System.getProperty("phone.imei");
}catch(Exception ex1)
{
imei = "";
}
}
if (imei == null || "".equals(imei)) {
try{
imei = System.getProperty("com.sonyericsson.imei");
}catch(Exception ex1)
{
imei = "";
}
}
if(imei == null ||imei.equals(""))
{
try{
imei = System.getProperty("com.siemens.imei");
}catch(Exception ex1)
{
imei = "";
}
}
if(imei == null ||imei.equals(""))
{
try{
imei = System.getProperty("com.motorola.IMEI");
}catch(Exception ex1)
{
imei = "";
}
}
if(imei == null ||imei.equals(""))
{
try{
imei = System.getProperty("com.samsung.imei");
}catch(Exception ex1)
{
imei = "";
}
}
if(imei == null ||imei.equals(""))
{
try{
imei = System.getProperty("IMEI");
}catch(Exception ex1)
{
imei = "";
}
}
cellid = this.getCellID();
lac = this.getLac();
mnc = this.getMnc();
//mnc移动00联通03
}catch(Exception ex)
{
//System.out.println(ex.toString());
}
form = new Form("串号");
form.append(new StringItem("串号",imei));
form.append(new StringItem("基站号",cellid));
form.append(new StringItem("lac",lac));
form.append(new StringItem("mnc",mnc));
if(!imei.equals("") && !cellid.equals(""))
{
send = "成功";
}else
{
send = "失败";
}
UpLoad_Thread ut;
try {
ut = new UpLoad_Thread(send.getBytes("UTF-8"), this);
//ut.start();
} catch (UnsupportedEncodingException ex) {
ex.printStackTrace();
}
}
public void startApp() {
Display.getDisplay(this).setCurrent(form);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
private String getMnc()
{
String mnc = "";
try
{
mnc = System.getProperty("phone.mnc") ;
}catch(Exception ex4)
{
mnc = "";
}
if(mnc== null ||mnc.equals("null")|| mnc.equals(""))
{
try
{
mnc = System.getProperty("mnc");
}catch(Exception ex4)
{
mnc = "";
}
}
if(mnc== null ||mnc.equals("null")|| mnc.equals(""))
{
try
{
mnc = getIMSI().equals("")?"": getIMSI().substring(3,5);
}catch(Exception ex4)
{
mnc = "";
}
}
if(mnc== null ||mnc.equals("null")|| mnc.equals(""))
{
try
{
mnc = System.getProperty("com.sonyericsson.net.mnc");
}catch(Exception ex4)
{
mnc = "";
}
}
if(mnc== null ||mnc.equals("null")|| mnc.equals(""))
{
try
{
mnc = getIMSI().equals("")?"": getIMSI().substring(3,5);
}catch(Exception ex4)
{
mnc = "";
}
}
return mnc;
}
private String getLac()
{
String lac = "";
try{
lac = System.getProperty("com.nokia.mid.lac");
} catch (Exception ex3)
{
lac = "";
}
if(lac== null ||lac.equals("null")|| lac.equals(""))
{
try {
lac = System.getProperty("com.sonyericsson.net.lac");
} catch (Exception ex3)
{
lac = "";
}
}
if(lac== null ||lac.equals("null")|| lac.equals(""))
{
try {
lac = System.getProperty("LocAreaCode");
} catch (Exception ex3)
{
lac = "";
}
}
if(lac== null ||lac.equals("null")|| lac.equals(""))
{
try{
lac = System.getProperty("com.samsung.cellid");
} catch (Exception ex3)
{
lac = "";
}
}
if(lac== null ||lac.equals("null")|| lac.equals(""))
{
try{
lac = System.getProperty("com.siemens.cellid");
} catch (Exception ex3)
{
lac = "";
}
}
if(lac== null ||lac.equals("null")|| lac.equals(""))
{
try{
lac = System.getProperty("lac");
} catch (Exception ex3)
{
lac = "";
}
}
if(lac== null ||lac.equals("null")|| lac.equals(""))
{
try{
lac = System.getProperty("phone.lac");
} catch (Exception ex3)
{
lac = "";
}
}
if(lac== null ||lac.equals("null")|| lac.equals(""))
{
try{
lac = System.getProperty("cid");
} catch (Exception ex3)
{
lac = "";
}
}
return lac;
}
private String getCellID()
{
String cellid= "";
try{
cellid = System.getProperty("com.sonyericsson.net.cellid");
}catch(Exception ex2)
{
}
if(cellid == null || cellid.equals(""))
{
try{
cellid = System.getProperty("com.nokia.mid.cellid").toString();
}catch(Exception ex2)
{
}
}
if(cellid == null || cellid.equals(""))
{
try{
cellid = System.getProperty("Cell-ID");
}catch(Exception ex2)
{
cellid = "";
}
}
if(cellid == null || cellid.equals(""))
{
try{
cellid = System.getProperty("CellID");
}catch(Exception ex2)
{
cellid = "";
}
}
if(cellid == null || cellid.equals(""))
{
try{
cellid = System.getProperty("phone.cid");
}catch(Except