| | |
| | | package com.hdl.photovoltaic; |
| | | |
| | | import android.app.Application; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.content.pm.PackageManager; |
| | | import android.location.Location; |
| | | import android.location.LocationListener; |
| | | import android.location.LocationManager; |
| | | import android.os.Bundle; |
| | | import android.text.TextUtils; |
| | | |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.core.app.ActivityCompat; |
| | | |
| | | import com.hdl.hdlhttp.HxHttpConfig; |
| | | import com.hdl.linkpm.sdk.HDLLinkPMSdk; |
| | | import com.hdl.linkpm.sdk.core.exception.HDLException; |
| | | import com.hdl.linkpm.sdk.home.type.HomeType; |
| | | import com.hdl.linkpm.sdk.user.HDLLinkPMUser; |
| | | import com.hdl.linkpm.sdk.user.callback.IOnReloginListener; |
| | | import com.hdl.linkpm.sdk.utils.HDLSDKSPUtils; |
| | | import com.hdl.photovoltaic.bean.MqttInfo; |
| | | import com.hdl.photovoltaic.config.AppConfigManage; |
| | | import com.hdl.photovoltaic.config.ConstantManage; |
| | | import com.hdl.photovoltaic.config.UserConfigManage; |
| | | import com.hdl.photovoltaic.enums.NetworkType; |
| | | import com.hdl.photovoltaic.listener.CloudCallBeak; |
| | | import com.hdl.photovoltaic.other.HdlLogLogic; |
| | | import com.hdl.photovoltaic.other.HdlOtaLogic; |
| | | import com.hdl.photovoltaic.other.HdlMessageLogic; |
| | | import com.hdl.photovoltaic.other.HdlMqttLogic; |
| | | import com.hdl.photovoltaic.other.HdlThreadLogic; |
| | | import com.hdl.photovoltaic.ui.HomeLoginActivity; |
| | | import com.hdl.photovoltaic.uni.HDLUniMPSDKManager; |
| | |
| | | import org.greenrobot.eventbus.EventBus; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Locale; |
| | | import java.util.Objects; |
| | | |
| | | import cn.jpush.android.api.JPushInterface; |
| | | import io.dcloud.common.util.RuningAcitvityUtil; |
| | | import io.dcloud.common.util.net.NetWork; |
| | | import okhttp3.logging.HttpLoggingInterceptor; |
| | | |
| | | public class HDLApp extends Application { |
| | |
| | | |
| | | @Override |
| | | public void onCreate() { |
| | | |
| | | super.onCreate(); |
| | | |
| | | mHDLApp = this; |
| | | SharedPreUtils.init(this); |
| | | getAppLanguage(); |
| | | initThirdSDK(); |
| | | // appLocationInfo(); |
| | | |
| | | } |
| | | |
| | | public void getAppLanguage() { |
| | |
| | | return; |
| | | } |
| | | isInitThirdSDK = true; |
| | | |
| | | // //5.初始化Bugly |
| | | // CrashReport.initCrashReport(this, Constant.BUGLY_APP_ID, true); |
| | | //6.初始化DCUniMPSDK |
| | |
| | | initSocket(); |
| | | //4.初始化OKHttpLog 是否开启 |
| | | setOKHttpLogOpen(isLogEnabled); |
| | | // initMqttClient(); |
| | | //监听网络状态变化 |
| | | this.networkMonitoring(); |
| | | //初始化本地assets文件夹资源文件 |
| | |
| | | //重新设定一个时间 |
| | | UserConfigManage.getInstance().setLoginDateTime(0); |
| | | UserConfigManage.getInstance().Save(); |
| | | |
| | | //清空消息缓存数据 |
| | | HdlMessageLogic.getInstance().clearListMessage(); |
| | | //清空缓存数据 |
| | | if (mInfoMap != null) { |
| | | mInfoMap.clear(); |
| | | } |
| | | |
| | | //断开mqtt连接 |
| | | if (MqttRecvClient.getInstance() != null) { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 初始化极光SDK |
| | | */ |
| | | private void initJPush() { |
| | | JPushInterface.setDebugMode(true); |
| | | JPushInterface.init(getBaseContext()); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 初始化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); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |