| | |
| | | import com.hdl.photovoltaic.other.HdlThreadLogic; |
| | | import com.hdl.photovoltaic.other.HdlUniLogic; |
| | | import com.hdl.photovoltaic.push.PushMessageInfoBean; |
| | | import com.hdl.photovoltaic.services.ForeService; |
| | | import com.hdl.photovoltaic.ui.bean.DeviceRemoteInfo; |
| | | import com.hdl.photovoltaic.ui.bean.HouseIdBean; |
| | | import com.hdl.photovoltaic.ui.bean.MessageBean; |
| | |
| | | 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 com.umeng.analytics.MobclickAgent; |
| | | |
| | | import org.greenrobot.eventbus.Subscribe; |
| | | import org.greenrobot.eventbus.ThreadMode; |
| | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | import cn.jpush.android.api.JPushInterface; |
| | | |
| | | /** |
| | | * C端-电站界面 |
| | |
| | | return; |
| | | } |
| | | PushMessageInfoBean pushMessageInfoBean = HdlPushLogic.getInstance().pushDataProcessing("", "", data); |
| | | if (TextUtils.isEmpty(pushMessageInfoBean.getMsgId())) { |
| | | if (TextUtils.isEmpty(pushMessageInfoBean.getMsgId()) && !pushMessageInfoBean.isAiPrompt()) { |
| | | return; |
| | | } |
| | | Log.d("==========111111", tag); |
| | | HDLUniMPSDKManager.uinEnabled = false; |
| | | if (tag.equals("onNewIntent")) { |
| | | HDLUniMPSDKManager.uinEnabled = false; |
| | |
| | | @Override |
| | | public void run() { |
| | | if (pushMessageInfoBean.isAiPrompt()) { |
| | | HdlUniLogic.getInstance().sendUni(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_open_ai_push_message, new HDLUniMP.UniCallBackBaseBean()); |
| | | HDLUniMP.UniCallBackBaseBean uniCallBackBaseBean = new HDLUniMP.UniCallBackBaseBean(); |
| | | uniCallBackBaseBean.setType(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_open_ai_push_message); |
| | | HdlUniLogic.getInstance().sendUni(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_MODEL, uniCallBackBaseBean); |
| | | HdlLogLogic.print("uni---原生主动向小程序发送通知AI事件---", false); |
| | | } else { |
| | | MessageBean messageBean = new MessageBean(); |
| | | messageBean.setMsgId(Long.valueOf(pushMessageInfoBean.getMsgId())); |
| | |
| | | intentMessageInfoActivity.setClass(_mActivity, MessageInfoActivity.class); |
| | | intentMessageInfoActivity.putExtra("messageBean", JSONObject.toJSONString(messageBean)); |
| | | startActivity(intentMessageInfoActivity); |
| | | HdlLogLogic.print("uni---原生主动向小程序发送通知AI事件---11111", false); |
| | | } |
| | | |
| | | } |
| | |
| | | HDLUniMPSDKManager.getInstance().getUniMP().closeUniMP(); |
| | | } |
| | | AppManagerUtils.getAppManager().finishAllActivity(); |
| | | //如果开发者调用kill或者exit之类的方法杀死进程,或者双击back键会杀死进程,请务必在此之前调用MobclickAgent.onKillProcess方法,用来保存统计数据。 |
| | | MobclickAgent.onKillProcess(_mActivity); |
| | | // //友盟sdk如果开发者调用kill或者exit之类的方法杀死进程,或者双击back键会杀死进程,请务必在此之前调用MobclickAgent.onKillProcess方法,用来保存统计数据。 |
| | | // MobclickAgent.onKillProcess(_mActivity); |
| | | Process.killProcess(Process.myPid()); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 上传极光注册ID到云端 |
| | | */ |
| | | private void pushTokens() { |
| | | String registrationId_tag = "registrationID_" + UserConfigManage.getInstance().getUserId(); |
| | | String is_registrationID = HDLApp.getInstance().getKey(registrationId_tag); |
| | | if (is_registrationID.equals("true")) { |
| | | //上过就没有必要在上传啦 |
| | | return; |
| | | } |
| | | |
| | | HdlThreadLogic.runSubThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | String registrationID = JPushInterface.getRegistrationID(_mActivity); |
| | | int addCount = 0; |
| | | while (TextUtils.isEmpty(registrationID)) { |
| | | SystemClock.sleep(1000);//1s休眠 |
| | | registrationID = JPushInterface.getRegistrationID(_mActivity); |
| | | addCount++; |
| | | if (addCount > 5) { |
| | | //5s超时 |
| | | break; |
| | | } |
| | | } |
| | | if (!TextUtils.isEmpty(registrationID)) { |
| | | // UserConfigManage.getInstance().setRegistrationID(registrationID); |
| | | // UserConfigManage.getInstance().Save(); |
| | | String finalRegistrationID = registrationID; |
| | | HdlResidenceLogic.getInstance().pushAdd(new CloudCallBeak<String>() { |
| | | @Override |
| | | public void onSuccess(String pushId) { |
| | | |
| | | if (!TextUtils.isEmpty(pushId)) { |
| | | UserConfigManage.getInstance().setPushToken(finalRegistrationID); |
| | | UserConfigManage.getInstance().setPushId(pushId); |
| | | UserConfigManage.getInstance().Save(); |
| | | } |
| | | HDLApp.getInstance().setInfoMap(registrationId_tag, "true");//记录一下状态,后台杀死app会清空; |
| | | HdlLogLogic.print("C端---添加极光ID到云端---registrationID:" + UserConfigManage.getInstance().getUserName() + "--->" + finalRegistrationID, true); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | HDLApp.getInstance().setInfoMap(registrationId_tag, "false");//记录一下状态,后台杀死app会清空; |
| | | HdlLogLogic.print("C端---添加极光ID到云端失败---registrationID:" + UserConfigManage.getInstance().getUserName() + "--->" + finalRegistrationID, true); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 上传 token 到服务器 |
| | | * |
| | | * @param token 令牌 |
| | |
| | | if (TextUtils.isEmpty(token)) { |
| | | return; |
| | | } |
| | | HdlResidenceLogic.getInstance().pushAdd(new CloudCallBeak<String>() { |
| | | HdlPushLogic.getInstance().pushAdd(new CloudCallBeak<String>() { |
| | | @Override |
| | | public void onSuccess(String pushId) { |
| | | |