private static boolean isSimulatorMethod(Context context)
{
TelephonyManager telmgr = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
String deviceID = telmgr.getDeviceId();
boolean isEmulator = "000000000000000".equalsIgnoreCase(deviceID);
if (isEmulator)
{
EsLog.i("xml", "模拟器deviceID:" + deviceID);
} else
{
EsLog.i("xml", "真机deviceID:" + deviceID);
}
return isEmulator;
}
public static String getIMSI(Context context) {
if (IMSI == null) {
TelephonyManager tm = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
IMSI = tm.getSubscriberId();
if (null != IMSI) {
EsLog.i("SIM", "SIM 1 imsi:" + IMSI);
} else {
try {
Method mtkGetIMSI = TelephonyManager.class.getMethod(
"getSubscriberIdGemini", int.class);
IMSI = (String) mtkGetIMSI.invoke(tm, 1);
EsLog.i("SIM", "SIM 2 imsi:" + IMSI);
} catch (Exception e) {
EsLog.i("SIM", "SIM 2 not support");
}
}
}
return IMSI;
}
public static String getIMEI(Context context) {
if (IMEI == null) {
TelephonyManager tm = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
IMEI = tm.getSimSerialNumber();
}
return IMEI;
}