this.runtime.setDBHelper(new DBHelper(getContentResolver(), this));\r
this.runtime.setContextProxy(new ContextProxy(this));\r
this.runtime.setLbsHelper(new LBSHelper(this,this.runtime.getContextProxy().getWifiManager(), this.runtime));\r
- if (Config.getIMEI(runtime.getContextProxy().context).isEmpty()){\r
- //如果配置里有IMEI,优先选配置里的,没有则选择系统的\r
- runtime.setImeiAndCid(PhoneUtils.getIMEI(this),"");\r
- } else{\r
- runtime.setImeiAndCid(Config.getIMEI(runtime.getContextProxy().context),"");\r
- }\r
+\r
this.runtime.setHRS(new heartRateStatus());\r
this.runtime.setUseQueue(true);\r
this.runtime.initDnsUtil(ICApplication.getInstance().getApplicationContext());\r
public void stopConnectionRetryTimer(){\r
if (mTimer_retry_connect !=null){\r
mTimer_retry_connect.cancel();\r
+ mTimer_retry_connect.purge();\r
mTimer_retry_connect = null;\r
}\r
}\r
import com.enqualcomm.support.utils.AlarmHelper;\r
import com.enqualcomm.support.utils.AlarmWakeUp;\r
import com.enqualcomm.support.utils.Connection;\r
+import com.enqualcomm.support.utils.DeviceInfoUtil;\r
import com.enqualcomm.support.utils.ICLogger;\r
import com.enqualcomm.support.utils.NettyConnection;\r
import com.enqualcomm.support.utils.NetworkObservable;\r
//心跳开始发送的时候,先重置response检测标志\r
is_heartBeat_send_success = false;\r
hearBeatResendCount++;\r
+ //更新系统的IMEI\r
+ boolean ret=DeviceInfoUtil.updateImei(mRuntime);\r
+ ICLogger.i("Update IMEI "+ret);\r
connection.send(protocolAPIHelper.genStringMessage("heart", protocolAPIHelper.AP03(mRuntime)));\r
}\r
}\r
// if (!connectionError) {\r
connectionError = false;\r
\r
+ //更新系统的IMEI\r
+ boolean ret=DeviceInfoUtil.updateImei(paramRuntime);\r
+ ICLogger.i("Update IMEI "+ret);\r
//发送登录包\r
Observable.timer(500L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
public void call(Long param1Long) {\r
import android.provider.Settings;\r
import android.telephony.TelephonyManager;\r
\r
+import com.enqualcomm.support.Config;\r
import com.enqualcomm.support.CoreService;\r
import com.enqualcomm.support.bean.StepCount;\r
import com.enqualcomm.support.bean.Runtime;\r
import java.io.FileInputStream;\r
import java.util.ArrayList;\r
\r
+import chestnut.utils.PhoneUtils;\r
+\r
public class DeviceInfoUtil {\r
private static final int CID_LENGTH = 16;\r
\r
return Build.MODEL;\r
}\r
\r
+ public static boolean updateImei(Runtime runtime){\r
+\r
+ String imei= Config.getIMEI(runtime.getContextProxy().context);\r
+ if (imei.isEmpty()){\r
+ //如果配置里有IMEI,优先选配置里的,没有则选择系统的\r
+ imei= PhoneUtils.getIMEI(runtime.getContextProxy().context);\r
+ if(imei==null) {\r
+ return false;\r
+ }else{\r
+ runtime.setImeiAndCid(imei, "");\r
+ }\r
+ } else{\r
+ runtime.setImeiAndCid(imei,"");\r
+ }\r
+\r
+ return true;\r
+ }\r
\r
/**\r
* 得到当前应用版本名称的方法\r
}\r
return i;\r
}\r
- \r
- public static String getIMEI(Context paramContext) {\r
- return ((TelephonyManager)paramContext.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId();\r
- }\r
- \r
- public static String getIMSI(Context paramContext) {\r
- return ((TelephonyManager)paramContext.getSystemService(Context.TELEPHONY_SERVICE)).getSubscriberId();\r
- }\r
- \r
+\r
public static boolean getLockSimInfo(Context paramContext) {\r
int i = 0;\r
try {\r
.append(",bph ").append(runtime.getHRS().getBPH())\r
.append(",bpl ").append(runtime.getHRS().getBPL())\r
.append(" at ").append(runtime.getHRS().getTestTime())\r
+ .append("\nrealimei:").append(PhoneUtils.getIMEI(runtime.getContextProxy().context))\r
.toString();\r
}\r
public static String getShortDeviceInfo(Runtime runtime){\r