| | |
| | | import android.content.Intent; |
| | | import android.content.res.Configuration; |
| | | import android.os.Build; |
| | | import android.os.Handler; |
| | | import android.os.LocaleList; |
| | | import android.os.Process; |
| | | import android.os.SystemClock; |
| | |
| | | HDLLinkPMUser.getInstance().setOnReloginListener(new IOnReloginListener() { |
| | | @Override |
| | | public void onReLogin(int type) { |
| | | if (5 == type) { |
| | | //切换服务器地址用的 |
| | | UserConfigManage.getInstance().setOnlineServer(!UserConfigManage.getInstance().isOnlineServer()); |
| | | UserConfigManage.getInstance().Save(); |
| | | restartApp(mHDLApp); |
| | | return; |
| | | } |
| | | |
| | | HdlLogLogic.print("监听到登录退出---" + type, true); |
| | | //type: 0:正常退出 1:极光推送强制退出 |
| | | //收到登录处理通知,关闭所有页面并打开登录页面 |
| | | AppManagerUtils.getAppManager().finishAllActivity(); |
| | | if (100 == type) { |
| | | new Handler().postDelayed(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | //切换服务器地址用的 |
| | | UserConfigManage.getInstance().setOnlineServer(!UserConfigManage.getInstance().isOnlineServer()); |
| | | UserConfigManage.getInstance().Save(); |
| | | restartApp(mHDLApp); |
| | | } |
| | | }, 500); |
| | | ; |
| | | } else { |
| | | HdlLogLogic.print("监听到登录退出---" + type, true); |
| | | //type: 0:正常退出 1:极光推送强制退出 |
| | | //收到登录处理通知,关闭所有页面并打开登录页面 |
| | | AppManagerUtils.getAppManager().finishAllActivity(); |
| | | // HDLSDKSPUtils.clear();//底层自己清空 |
| | | |
| | | //清空住宅id |
| | | UserConfigManage.getInstance().setHomeId(""); |
| | | //重新登陆,默认同意隐私政策 |
| | | UserConfigManage.getInstance().setAcceiptPolicy(false); |
| | | //重新设定一个时间 |
| | | UserConfigManage.getInstance().setLoginDateTime(0); |
| | | UserConfigManage.getInstance().Save(); |
| | | //清空住宅id |
| | | UserConfigManage.getInstance().setHomeId(""); |
| | | //重新登陆,默认同意隐私政策 |
| | | UserConfigManage.getInstance().setAcceiptPolicy(false); |
| | | //重新设定一个时间 |
| | | 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 |
| | | //清空消息缓存数据 |
| | | 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(); |
| | | 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); |
| | | if (type == 1) { |
| | | intent.putExtra("isJpush", true); |
| | | } |
| | | startActivity(intent); |
| | | } |
| | | SystemClock.sleep(200); |
| | | initDCUniMPSDK(); |
| | | Intent intent = new Intent(getInstance(), LoginActivity.class); |
| | | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); |
| | | if (type == 1) { |
| | | intent.putExtra("isJpush", true); |
| | | } |
| | | startActivity(intent); |
| | | |
| | | } |
| | | }); |