| | |
| | | restartApp(mHDLApp); |
| | | } |
| | | }, 500); |
| | | } else if (type == LogoutType.UniLogout.getValue()) { |
| | | AppManagerUtils.getAppManager().finishAllActivity(); |
| | | //清空住宅id |
| | | UserConfigManage.getInstance().setHomeId(""); |
| | | UserConfigManage.getInstance().setAutomaticSkipNoNetworkFlag(true); |
| | | //重新设定一个时间 |
| | | UserConfigManage.getInstance().setLoginDateTime(0); |
| | | UserConfigManage.getInstance().Save(); |
| | | //清空消息缓存数据 |
| | | HdlMessageLogic.getInstance().clearListMessage(); |
| | | //清空电站缓存数据 |
| | | HdlResidenceLogic.getInstance().clearHouseList(); |
| | | //清空设备缓存数据 |
| | | HdlDeviceLogic.getInstance().clearDeviceList(); |
| | | //清空缓存数据 |
| | | if (mInfoMap != null) { |
| | | mInfoMap.clear(); |
| | | } |
| | | //断开mqtt连接 |
| | | if (MqttRecvClient.getInstance() != null) { |
| | | MqttRecvClient.getInstance().disConnect(); |
| | | } |
| | | //断开所有tcp连接且清空连接缓存 |
| | | // TODO: 10/10/23 |
| | | // TcpSocketBoot.stopAllConnectLinkGateway(); |
| | | if (null != HDLUniMPSDKManager.getInstance().getUniMP()) { |
| | | HDLUniMPSDKManager.getInstance().getUniMP().closeUniMP(); |
| | | } |
| | | SystemClock.sleep(200); |
| | | initDCUniMPSDK(); |
| | | Intent intent = new Intent(getInstance(), LoginActivity.class); |
| | | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); |
| | | startActivity(intent); |
| | | } else { |
| | | HdlLogLogic.print("监听到登录退出---" + type, true); |
| | | //删除推送Token |
| | |
| | | /** |
| | | * 重启app |
| | | */ |
| | | // private void restartApp(Context context) { |
| | | // try { |
| | | private void restartApp(Context context) { |
| | | try { |
| | | // MobclickAgent.onKillProcess(context); |
| | | // Intent intent = new Intent(context, StartActivity.class); |
| | | // intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); |
| | | // context.startActivity(intent); |
| | | // killAppProcess(context); |
| | | // } catch (Exception e) { |
| | | // String a = e.getMessage(); |
| | | // } |
| | | // } |
| | | SystemClock.sleep(300); |
| | | Intent intent = new Intent(context, StartActivity.class); |
| | | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); |
| | | context.startActivity(intent); |
| | | killAppProcess(context); |
| | | } catch (Exception e) { |
| | | String a = e.getMessage(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 关掉app所有进程 |