| | |
| | | package com.hdl.photovoltaic; |
| | | |
| | | import android.app.Application; |
| | | import android.content.ComponentName; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.content.ServiceConnection; |
| | | import android.content.res.Configuration; |
| | | import android.content.res.Resources; |
| | | import android.os.IBinder; |
| | | import android.text.TextUtils; |
| | | import android.util.DisplayMetrics; |
| | | |
| | | |
| | | import com.hdl.hdlhttp.HxHttpConfig; |
| | |
| | | import com.hdl.linkpm.sdk.user.callback.IOnReloginListener; |
| | | import com.hdl.linkpm.sdk.utils.HDLSDKSPUtils; |
| | | import com.hdl.photovoltaic.config.AppConfigManage; |
| | | import com.hdl.photovoltaic.config.ConstantManage; |
| | | import com.hdl.photovoltaic.config.UserConfigManage; |
| | | import com.hdl.photovoltaic.internet.HttpServer.MyNanoHttpServer; |
| | | import com.hdl.photovoltaic.internet.HttpServer.MyNanoHttpService; |
| | | import com.hdl.photovoltaic.other.HdlFileLogic; |
| | | import com.hdl.photovoltaic.other.HdlOtaLogic; |
| | | import com.hdl.photovoltaic.other.HdlThreadLogic; |
| | | import com.hdl.photovoltaic.enums.NetworkType; |
| | | import com.hdl.photovoltaic.ui.HomeLoginActivity; |
| | | import com.hdl.photovoltaic.uni.HDLUniMPSDKManager; |
| | | import com.hdl.photovoltaic.utils.AppManagerUtils; |
| | | import com.hdl.photovoltaic.utils.LocalManageUtil; |
| | | import com.hdl.photovoltaic.utils.NetworkUtils; |
| | | import com.hdl.photovoltaic.utils.SharedPreUtils; |
| | | import com.hdl.sdk.link.HDLLinkLocalSdk; |
| | | import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus; |
| | | import com.hdl.sdk.link.core.connect.HDLUdpConnect; |
| | | import com.hdl.sdk.link.core.utils.QueueUtils; |
| | | import com.hdl.sdk.link.core.utils.mqtt.MqttRecvClient; |
| | | |
| | | import org.greenrobot.eventbus.EventBus; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Locale; |
| | |
| | | initSocket(); |
| | | //4.初始化OKHttpLog 是否开启 |
| | | setOKHttpLogOpen(isLogEnabled); |
| | | |
| | | |
| | | //监听网络状态变化 |
| | | this.networkMonitoring(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 初始化HDLLinkPMSdk |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 监听网络状态变化 |
| | | */ |
| | | private void networkMonitoring() { |
| | | NetworkUtils.init(getInstance()); |
| | | NetworkUtils.registerNetworkStatusChangedListener(new NetworkUtils.OnNetworkStatusChangedListener() { |
| | | @Override |
| | | public void onDisconnected() { |
| | | BaseEventBus baseEventBus = new BaseEventBus(); |
| | | baseEventBus.setTopic(ConstantManage.network_change_post); |
| | | baseEventBus.setType(NetworkType.no_network.toString()); |
| | | baseEventBus.setData("当前无网络连接"); |
| | | EventBus.getDefault().post(baseEventBus); |
| | | } |
| | | |
| | | @Override |
| | | public void onConnected(NetworkUtils.NetworkType networkType) { |
| | | BaseEventBus mobile_network = new BaseEventBus(); |
| | | mobile_network.setTopic(ConstantManage.network_change_post); |
| | | mobile_network.setType(networkType.toString()); |
| | | mobile_network.setData("正在使用2G/3G/4G网络/wifi"); |
| | | EventBus.getDefault().post(mobile_network); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | // /** |
| | | // * 初始化uni app mqtt |