From b9c6f40690f4a34f69e1b149888ac11a19520e89 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期五, 18 四月 2025 14:12:23 +0800
Subject: [PATCH] 2025-04-18 14:12:01 集成友盟SDK抓闪退
---
app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java | 25 +++++++++++++++++++++----
1 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java
index 34f0e01..cf3ffb2 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/CPowerStationActivity.java
@@ -44,6 +44,7 @@
import com.hdl.sdk.link.core.bean.gateway.GatewayBean;
import com.hdl.sdk.link.core.config.HDLLinkConfig;
import com.hdl.sdk.link.core.utils.mqtt.MqttRecvClient;
+import com.umeng.analytics.MobclickAgent;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
@@ -72,6 +73,7 @@
@Override
public void onBindView(Bundle savedInstanceState) {
setStatusBarTranslucent();
+ getWindow().setNavigationBarColor(getColor(R.color.text_FF000000));
//C绔惎鍔ˋpp鑷姩鎵撳紑灏忕▼搴忕數绔欒鎯呯晫闈�
startAppAutomaticallyOpenUni();
//娉ㄥ唽鐩戝惉
@@ -130,7 +132,7 @@
return;
}
int index = -1;
- List<GatewayBean> list = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(UserConfigManage.getInstance().getHomeId());
+ List<GatewayBean> list = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(UserConfigManage.getInstance().getHomeId(), null);
for (int i = 0; i < list.size(); i++) {
GatewayBean gatewayBean = list.get(i);
if (gatewayBean.getGatewayId().equals(topics[2])) {
@@ -204,8 +206,8 @@
}
String homeId = event.getData().toString();
//杩涘幓浣忓畢璇︽儏uni璇诲彇閫嗗彉鍣ㄥ垪琛ㄦ垚鍔熷悗閫氱煡
- for (int i = 0; i < HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId).size(); i++) {
- String gatewayId = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId).get(i).getGatewayId();
+ for (int i = 0; i < HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId, null).size(); i++) {
+ String gatewayId = HdlDeviceLogic.getInstance().getCurrentHomeGatewayList(homeId, null).get(i).getGatewayId();
//瀛楃涓叉槸鑷繁鎸夎鍒欐嫾鎺ョ殑,閲岄潰娉ㄥ唽涓婚鏃朵細瑙f瀽瀛楃涓�,鍙嬁getGatewayId()鍊�;
String topic = "/user/" + gatewayId + "/#";
//杩涘幓浣忓畢璇︽儏寮�濮嬭闃呬富棰�
@@ -230,10 +232,12 @@
// }
if (TextUtils.isEmpty(HDLLinkPMUser.getInstance().getAccessToken())) {
//鍏跺疄鍒锋柊token澶辫触宸查�氱煡閫�鍑虹櫥褰曪紝鏁版嵁宸茬粡娓呯┖锛屽洜涓虹瓑2s uni鍔犺浇鎱㈠鑷磋姹傞摼鎺ョ殑鏃跺�欏嚭鐜皌oken涓虹┖
+ HdlLogLogic.print("杩斿洖鍘�");
return;
}
+ UserConfigManage.getInstance().setUniBottomSafeDistanceBackgroundColor(0);
List<HouseIdBean> HouseIdList = HdlResidenceLogic.getInstance().getHouseIdList();
- if (HouseIdList.size() == 0) {
+ if (HouseIdList.isEmpty()) {
if (TextUtils.isEmpty(UserConfigManage.getInstance().getHomeId())) {
String path = HDLUniMP.UNI_EVENT_OPEN_HOME_Null_C;
HdlUniLogic.getInstance().openUniMP(path, null);
@@ -291,6 +295,8 @@
HDLUniMPSDKManager.getInstance().getUniMP().closeUniMP();
}
AppManagerUtils.getAppManager().finishAllActivity();
+ //濡傛灉寮�鍙戣�呰皟鐢╧ill鎴栬�卐xit涔嬬被鐨勬柟娉曟潃姝昏繘绋嬶紝鎴栬�呭弻鍑籦ack閿細鏉�姝昏繘绋嬶紝璇峰姟蹇呭湪姝や箣鍓嶈皟鐢∕obclickAgent.onKillProcess鏂规硶锛岀敤鏉ヤ繚瀛樼粺璁℃暟鎹��
+ MobclickAgent.onKillProcess(_mActivity);
Process.killProcess(Process.myPid());
}
}
@@ -449,7 +455,18 @@
}
+ } else if (linkResponse.getTopic().endsWith("/app/thing/property/send")) {
+ //璁惧鐘舵�佸彉鏇磘opic锛�/user/${homeId}/app/thing/property/send
+ if (linkResponse.getData() == null) {
+ HdlLogLogic.print("璁惧鐘舵�佸彉鏇�--->鏁版嵁涓虹┖", false);
+ return;
+ }
+ HDLUniMP.UniCallBackBaseBean uniCallBackBaseBean = new HDLUniMP.UniCallBackBaseBean();
+ uniCallBackBaseBean.setType(linkResponse.getTopic());
+ uniCallBackBaseBean.setData(linkResponse.getData());
+ HdlUniLogic.getInstance().sendUni(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_MODEL, uniCallBackBaseBean);
}
+
}
}
};
--
Gitblit v1.8.0