| | |
| | | package com.hdl.photovoltaic; |
| | | |
| | | import android.app.Activity; |
| | | import android.app.Application; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.content.res.Configuration; |
| | | import android.os.SystemClock; |
| | | import android.text.TextUtils; |
| | | import android.util.Log; |
| | | |
| | | |
| | | import androidx.multidex.MultiDex; |
| | |
| | | |
| | | import cn.jpush.android.api.JPushInterface; |
| | | import io.dcloud.common.util.RuningAcitvityUtil; |
| | | import me.jessyan.autosize.AutoSize; |
| | | import me.jessyan.autosize.AutoSizeConfig; |
| | | import me.jessyan.autosize.onAdaptListener; |
| | | import me.jessyan.autosize.utils.ScreenUtils; |
| | | import okhttp3.logging.HttpLoggingInterceptor; |
| | | |
| | | public class HDLApp extends Application { |
| | |
| | | public void onCreate() { |
| | | super.onCreate(); |
| | | |
| | | // 获取当前进程的PID |
| | | Log.d("进程===", android.os.Process.myPid() + ""); |
| | | mHDLApp = this; |
| | | SharedPreUtils.init(this); |
| | | getAppLanguage(); |
| | | initThirdSDK(); |
| | | init(); |
| | | // appLocationInfo(); |
| | | } |
| | | |
| | |
| | | /** |
| | | * 初始化三方相关SDK |
| | | */ |
| | | public void initThirdSDK() { |
| | | public void init() { |
| | | // 小程序进程 |
| | | if (RuningAcitvityUtil.getAppName(getBaseContext()).contains(":")) { |
| | | return; |
| | |
| | | // TypeUtils.compatibleWithFieldName = true; |
| | | // //9.初始化网络工具 |
| | | // NetWorkUtil.init(this); |
| | | initAutoSize(); |
| | | //初始化极光推送 |
| | | initJPush(); |
| | | initHDLLinkPMSdk(); |
| | |
| | | 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.FLAG_ACTIVITY_CLEAR_TOP); |
| | | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); |
| | | if (type == 1) { |
| | | intent.putExtra("isJpush", true); |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 蓝湖上 修改宽度 640dp 宽度按照dp、sp来适配 |
| | | * 旋转后高变宽,按旋转后高度适配,所以宽度不写死 |
| | | */ |
| | | private void initAutoSize() { |
| | | AutoSize.initCompatMultiProcess(this); |
| | | boolean isBaseOnWidth = getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT; |
| | | AutoSizeConfig.getInstance() |
| | | .setBaseOnWidth(true) |
| | | .setCustomFragment(true) |
| | | .setDesignWidthInDp(375) |
| | | .setDesignHeightInDp(812) |
| | | .setUseDeviceSize(false) |
| | | .setOnAdaptListener(new onAdaptListener() { |
| | | @Override |
| | | public void onAdaptBefore(Object target, Activity activity) { |
| | | |
| | | AutoSizeConfig.getInstance().setScreenWidth(ScreenUtils.getScreenSize(activity)[0]); |
| | | AutoSizeConfig.getInstance().setScreenHeight(ScreenUtils.getScreenSize(activity)[1] + |
| | | ScreenUtils.getHeightOfNavigationBar(activity) + ScreenUtils.getStatusBarHeight()); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onAdaptAfter(Object target, Activity activity) { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 初始化uni app mqtt |
| | |
| | | MultiDex.install(base); |
| | | super.attachBaseContext(base); |
| | | } |
| | | |
| | | |
| | | |
| | | } |