| | |
| | | package com.hdl.photovoltaic; |
| | | |
| | | import android.app.Application; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.os.SystemClock; |
| | | import android.text.TextUtils; |
| | | |
| | | |
| | | import androidx.multidex.MultiDex; |
| | | |
| | | import com.hdl.hdlhttp.HxHttpConfig; |
| | | import com.hdl.linkpm.sdk.HDLLinkPMSdk; |
| | |
| | | import com.hdl.photovoltaic.utils.LocalManageUtil; |
| | | import com.hdl.photovoltaic.utils.NetworkUtils; |
| | | import com.hdl.photovoltaic.utils.SharedPreUtils; |
| | | import com.hdl.photovoltaic.widget.ConfirmationCancelDialog; |
| | | import com.hdl.sdk.link.HDLLinkLocalSdk; |
| | | import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus; |
| | | import com.hdl.sdk.link.core.connect.HDLUdpConnect; |
| | |
| | | */ |
| | | public void initThirdSDK() { |
| | | // 小程序进程 |
| | | if (RuningAcitvityUtil.getAppName(getBaseContext()).contains("unimp")) { |
| | | if (RuningAcitvityUtil.getAppName(getBaseContext()).contains(":")) { |
| | | return; |
| | | } |
| | | if (isInitThirdSDK) { |
| | |
| | | //监听网络状态变化 |
| | | this.networkMonitoring(); |
| | | //初始化本地assets文件夹资源文件 |
| | | this.initLocalAssetsData(); |
| | | // this.initLocalAssetsData(); |
| | | |
| | | } |
| | | |
| | |
| | | if (mInfoMap != null) { |
| | | mInfoMap.clear(); |
| | | } |
| | | |
| | | //断开mqtt连接 |
| | | if (MqttRecvClient.getInstance() != null) { |
| | | MqttRecvClient.getInstance().stop(); |
| | | } |
| | | // //断开mqtt连接 |
| | | // if (MqttRecvClient.getInstance() != null) { |
| | | // 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(); |
| | | } |
| | | SystemClock.sleep(200); |
| | | initDCUniMPSDK(); |
| | | Intent intent = new Intent(getInstance(), HomeLoginActivity.class); |
| | | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| | | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_CLEAR_TOP); |
| | | if (type == 1) { |
| | | intent.putExtra("isJpush", true); |
| | | } |
| | |
| | | */ |
| | | private void initUniMqtt() { |
| | | try { |
| | | String ip = NetworkUtils.getIPAddress(this); |
| | | String ip = "10.10.35.79";//NetworkUtils.getIPAddress(this); |
| | | if (TextUtils.isEmpty(ip)) { |
| | | return; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 初始化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); |
| | | } |
| | | }); |
| | | @Override |
| | | protected void attachBaseContext(Context base) { |
| | | MultiDex.install(base); |
| | | super.attachBaseContext(base); |
| | | } |
| | | |
| | | } |