| | |
| | | import com.hdl.photovoltaic.config.UserConfigManage; |
| | | import com.hdl.photovoltaic.listener.CloudCallBeak; |
| | | import com.hdl.photovoltaic.other.HdlResidenceLogic; |
| | | import com.hdl.photovoltaic.other.HdlUniLogic; |
| | | import com.hdl.photovoltaic.ui.bean.HouseIdBean; |
| | | import com.hdl.photovoltaic.ui.me.WebActivity; |
| | | import com.hdl.photovoltaic.uni.HDLUniMP; |
| | | import com.hdl.photovoltaic.uni.HDLUniMPSDKManager; |
| | | import com.hdl.photovoltaic.utils.LocalManageUtil; |
| | | import com.hdl.photovoltaic.utils.SharedPreUtils; |
| | | import com.hdl.photovoltaic.widget.ConfirmationCancelDialog; |
| | | import com.umeng.commonsdk.UMConfigure; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | getWindow().setNavigationBarColor(getColor(R.color.text_FF000000)); |
| | | //发布审核小米应用市场要求APP第一次启动提前提示《用户协议》和《隐私政策》才允许上线 |
| | | final String key = "is_login"; |
| | | HDLUniMPSDKManager.isExistsActivity = false; |
| | | boolean isLogin = SharedPreUtils.getBoolean(key); |
| | | if (!isLogin) { |
| | | ConfirmationCancelDialog confirmationCancelDialog = new ConfirmationCancelDialog(this); |
| | |
| | | }); |
| | | } else { |
| | | initSdk(); |
| | | //初始化服务器域名(用户注册所在服务器域名地址) |
| | | AppConfigManage.setUserRegionUrl(HDLLinkPMUser.getInstance().getUserRegionUrl()); |
| | | //判断AccessToken是否null |
| | | if (!TextUtils.isEmpty(HDLLinkPMUser.getInstance().getAccessToken())) { |
| | | if (UserConfigManage.getInstance().isBAccount()) { |
| | | //安装商跳转界面 |
| | | Intent intent = new Intent(); |
| | | intent.setClass(StartActivity.this, BPowerStationActivity.class); |
| | | openActivity(intent); |
| | | } else { |
| | | //C端用户跳转界面 |
| | | if (!UserConfigManage.getInstance().isNoNetworkFlag()) { |
| | | //初始化服务器域名(用户注册所在服务器域名地址) |
| | | AppConfigManage.setUserRegionUrl(HDLLinkPMUser.getInstance().getUserRegionUrl()); |
| | | //判断AccessToken是否null |
| | | if (!TextUtils.isEmpty(HDLLinkPMUser.getInstance().getAccessToken())) { |
| | | if (UserConfigManage.getInstance().isBAccount()) { |
| | | //安装商跳转界面 |
| | | Intent intent = new Intent(); |
| | | intent.setClass(StartActivity.this, BPowerStationActivity.class); |
| | | openActivity(intent); |
| | | } else { |
| | | //C端用户跳转界面 |
| | | // showLoading(); |
| | | HdlResidenceLogic.getInstance().getResidenceIdList("", "", new CloudCallBeak<List<HouseIdBean>>() { |
| | | @Override |
| | | public void onSuccess(List<HouseIdBean> obj) { |
| | | HdlResidenceLogic.getInstance().getResidenceIdList("", "", new CloudCallBeak<List<HouseIdBean>>() { |
| | | @Override |
| | | public void onSuccess(List<HouseIdBean> obj) { |
| | | // hideLoading(); |
| | | HdlResidenceLogic.getInstance().setHouseIdList(obj); |
| | | Intent intent = new Intent(); |
| | | intent.setClass(StartActivity.this, CPowerStationActivity.class); |
| | | openActivity(intent); |
| | | } |
| | | HdlResidenceLogic.getInstance().setHouseIdList(obj); |
| | | Intent intent = new Intent(); |
| | | intent.setClass(StartActivity.this, CPowerStationActivity.class); |
| | | openActivity(intent); |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | // hideLoading(); |
| | | Intent intent = new Intent(); |
| | | intent.setClass(StartActivity.this, CPowerStationActivity.class); |
| | | openActivity(intent); |
| | | } |
| | | }); |
| | | Intent intent = new Intent(); |
| | | intent.setClass(StartActivity.this, CPowerStationActivity.class); |
| | | openActivity(intent); |
| | | } |
| | | }); |
| | | } |
| | | } else { |
| | | Intent intent = new Intent(); |
| | | intent.setClass(StartActivity.this, LoginActivity.class); |
| | | openActivity(intent); |
| | | } |
| | | } else { |
| | | Intent intent = new Intent(); |
| | | intent.setClass(StartActivity.this, LoginActivity.class); |
| | | openActivity(intent); |
| | | //无网模式-跳到小程序设备列表界面 |
| | | String path = HDLUniMP.UNI_EVENT_OPEN_NONETWORKDEVICELIST + "?mac=" + UserConfigManage.getInstance().getNoNetworkDeviceMac() + "&password=" + UserConfigManage.getInstance().getNoNetworkPassword(); |
| | | HdlUniLogic.getInstance().openUniMP(path, null); |
| | | } |
| | | } |
| | | |
| | |
| | | return; |
| | | } |
| | | HDLApp.getInstance().isStartInitThirdSDK = true; |
| | | //初始化友盟SDK |
| | | initUMengSDK(); |
| | | //初始化极光推送 |
| | | initJPush(); |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | JPushInterface.init(getBaseContext()); |
| | | } |
| | | |
| | | /** |
| | | * 初始化友盟SDK,抓闪退日志 |
| | | * 集成教程地址:https://developer.umeng.com/docs/119267/detail/118588 |
| | | */ |
| | | private void initUMengSDK() { |
| | | UMConfigure.preInit(this, "6801aec0bc47b67d833fd76d", "XenterraSolar"); |
| | | //appkey和channl必须保持和预初始化一致!!! |
| | | //deviceType:设备类型,UMConfigure.DEVICE_TYPE_PHONE为手机、UMConfigure.DEVICE_TYPE_BOX为盒子 |
| | | //pushSecret:Push推送业务的secret |
| | | UMConfigure.init(this, "6801aec0bc47b67d833fd76d", "XenterraSolar", UMConfigure.DEVICE_TYPE_PHONE, ""); |
| | | UMConfigure.setLogEnabled(false);//AppConfigManage.isDebug() |
| | | } |
| | | |
| | | } |