| | |
| | | // CrashReport.initCrashReport(this, Constant.BUGLY_APP_ID, true); |
| | | //6.初始化DCUniMPSDK |
| | | initDCUniMPSDK(); |
| | | // this.initUniMqtt();//如果是部署到/手机上正式使用,注释掉这行代码就可 |
| | | this.initUniMqtt();//如果是部署到/手机上正式使用,注释掉这行代码就可 |
| | | // //7.初始化自定义IconToast |
| | | // ToastUtils.getInstance().initIconToast(this); |
| | | // //8.对fastjson进行设置,解决fastjosn转换成字符串时首字母大小写问题 |
| | |
| | | |
| | | //断开mqtt连接 |
| | | if (MqttRecvClient.getInstance() != null) { |
| | | MqttRecvClient.getInstance().stop(); |
| | | MqttRecvClient.getInstance().disConnect(); |
| | | } |
| | | //断开所有tcp连接且清空连接缓存 |
| | | // TODO: 10/10/23 |
| | | // TcpSocketBoot.stopAllConnectLinkGateway(); |
| | | // if(null!=HDLUniMPSDKManager.getInstance().getUniMP()){ |
| | | // LogUtils.d("asdfasdfasdfsdf我被删除啦"); |
| | | // HDLUniMPSDKManager.getInstance().getUniMP().closeUniMP(); |
| | | // } |
| | | // initDCUniMPSDK(); |
| | | if (null != HDLUniMPSDKManager.getInstance().getUniMP()) { |
| | | HDLUniMPSDKManager.getInstance().getUniMP().closeUniMP(); |
| | | } |
| | | initDCUniMPSDK(); |
| | | Intent intent = new Intent(getInstance(), HomeLoginActivity.class); |
| | | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| | | if (type == 1) { |
| | |
| | | */ |
| | | private void initUniMqtt() { |
| | | try { |
| | | String ip = NetworkUtils.getIPAddress(this); |
| | | String ip = "10.10.35.79";//NetworkUtils.getIPAddress(this); |
| | | if (TextUtils.isEmpty(ip)) { |
| | | return; |
| | | } |
| | |
| | | HdlLogLogic.print("测试Mqtt连接服务端失败--->"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 初始化mqtt客户端 |
| | | */ |
| | | public void initMqttClient() { |
| | | |
| | | HdlMqttLogic.getInstance().getMqttRemoteInfo(HomeType.A, new CloudCallBeak<MqttInfo>() { |
| | | @Override |
| | | public void onSuccess(MqttInfo info) { |
| | | if (info != null) { |
| | | MqttRecvClient.init(HDLApp.getInstance(), info.getUrl(), info.getClientId(), info.getUserName(), info.getPassWord()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | HdlLogLogic.print("读取mqtt远程信息失败--->" + e.getMessage(), e.getCode(), true); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |