wjc
2024-11-27 22c83310cbc4b04615be42d51645b47eff87cb7d
app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMPSDKManager.java
@@ -159,9 +159,10 @@
                    if (onOtherUniMPEventCallBack != null) {
                        onOtherUniMPEventCallBack.onOtherUniMPEventReceive(appid, event, data, callback);
                    } else {
                        //有可能是系统回收掉activity到知道回调为null,这样情况下强制返回登录界面;
                        HDLLinkPMUser.getInstance().logout(0);
                        HdlLogLogic.print("收到小程序通知,回调事件为null,无法回调事件并执行业务逻辑--->event=" + event + "\r\n" + "data=" + data, true);
                        //有可能是系统回收掉activity导致回调为null,这样情况下强制返回登录界面;
                        //todo 长时间没响应将退出登录界面重新登录
                        HDLLinkPMUser.getInstance().logout(0);
                    }
                }
            }
@@ -279,13 +280,13 @@
                uniMPOpenConfiguration.splashClass = MySplashView.class;
                uniMP = DCUniMPSDK.getInstance().openUniMP(mContext, uniAppId, uniMPOpenConfiguration);
            }
            //android14有些设备有问题,需要等待
            if (android.os.Build.VERSION.SDK_INT >= 34) {
                if (TextUtils.isEmpty(mCurrentAppId)) {
                    //第一次用要休眠
                    SystemClock.sleep(1000);
                }
            }
//            //android14有些设备有问题,需要等待
//            if (android.os.Build.VERSION.SDK_INT >= 34) {
//                if (TextUtils.isEmpty(mCurrentAppId)) {
//                    //第一次用要休眠
//                    SystemClock.sleep(1000);
//                }
//            }
            mCurrentAppId = uniAppId;//记录当前小程序
            mUniMPCaches.put(uniMP.getAppid(), uniMP);
        } catch (Exception e) {
@@ -363,12 +364,12 @@
        if (mUniMPCaches.containsKey(uniAppId)) {
            if (mUniMPCaches.get(uniAppId) != null) {
                mUniMPCaches.get(uniAppId).sendUniMPEvent(topic, data);
                HdlLogLogic.print("Android--->通知---uni--->主题:" + topic + "--->发送数据:" + new Gson().toJson(data));
                HdlLogLogic.print("Android---通知---uni---主题:" + topic + "---发送数据:" + new Gson().toJson(data));
            } else {
                HdlLogLogic.print("Android--->通知---uni--->失败--->小程序对象为空:" + uniAppId);
                HdlLogLogic.print("Android---通知---uni---失败---小程序对象为空:" + uniAppId);
            }
        } else {
            HdlLogLogic.print("Android--->通知---uni--->失败--->小程序对象为空:" + uniAppId);
            HdlLogLogic.print("Android---通知---uni--->失败---¬小程序对象为空:" + uniAppId);
        }
    }
@@ -421,7 +422,7 @@
    public void checkRemoveOtherUniMPEventCallBack(IOnOtherUniMPEventCallBack onOtherUniMPEventCallBack) {
        if (this.onOtherUniMPEventCallBack == onOtherUniMPEventCallBack) {
            this.onOtherUniMPEventCallBack = null;
            HdlLogLogic.print("onOtherUniMPEventCallBack remove callback");
            HdlLogLogic.print("onOtherUniMPEventCallBack remove callback", true);
        }
    }