| | |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hdl.linkpm.sdk.core.exception.HDLException; |
| | | import com.hdl.linkpm.sdk.home.type.HomeType; |
| | | import com.hdl.photovoltaic.HDLApp; |
| | | import com.hdl.photovoltaic.R; |
| | | import com.hdl.photovoltaic.base.CustomBaseActivity; |
| | | import com.hdl.photovoltaic.bean.MqttInfo; |
| | |
| | | private ActivityMyPowerStationBinding viewBinding; |
| | | private int currentFragmentIndex = 1; |
| | | private EventListener allTopicsListener; |
| | | |
| | | private int backPressTimes; |
| | | |
| | | private NetworkChangeReceiver networkChangeReceiver; |
| | | |
| | | |
| | | @Override |
| | | public Object getContentView() { |
| | |
| | | this.registerAllTopicsListener(); |
| | | //初始化mqtt客户端 |
| | | this.initMqttClient(); |
| | | |
| | | //上传极光注册ID |
| | | //上传极光注册ID到云端 |
| | | this.pushTokens(); |
| | | //点击极光通知栏消息进来 |
| | | this.clickJpushNotificationMessage(); |
| | |
| | | |
| | | |
| | | /** |
| | | * 上传极光注册ID |
| | | * 上传极光注册ID到云端 |
| | | */ |
| | | private void pushTokens() { |
| | | String is_registrationID = HDLApp.getInstance().getKey("registrationID"); |
| | | if (is_registrationID.equals("true")) { |
| | | //上过就没有必要在上传啦 |
| | | return; |
| | | } |
| | | |
| | | HdlThreadLogic.runSubThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | |
| | | UserConfigManage.getInstance().setPushId(pushId); |
| | | UserConfigManage.getInstance().Save(); |
| | | } |
| | | HDLApp.getInstance().setInfoMap("registrationID", "true");//记录一下状态,后台杀死app会清空; |
| | | HdlLogLogic.print("添加极光ID到云端--->registrationID:" + finalRegistrationID, true); |
| | | |
| | | } |
| | |
| | | boolean isBoolean = PermissionUtils.isNotificationEnabled(_mActivity); |
| | | if (!isBoolean) { |
| | | ConfirmationCancelDialog confirmationCancelDialog = new ConfirmationCancelDialog(_mActivity); |
| | | confirmationCancelDialog.setTitle("提示"); |
| | | confirmationCancelDialog.setContent("通知权限没开启,将无法收到推送信息."); |
| | | confirmationCancelDialog.setConfirmation("前往设置"); |
| | | confirmationCancelDialog.setTitle(getString(R.string.loading_title_tip)); |
| | | confirmationCancelDialog.setContent(getString(R.string.no_permissions_unable_to_receive_push)); |
| | | confirmationCancelDialog.setConfirmation(getString(R.string.go_to_settings)); |
| | | confirmationCancelDialog.show(); |
| | | confirmationCancelDialog.setYesOnclickListener(new ConfirmationCancelDialog.onYesOnclickListener() { |
| | | @Override |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 监听网络状态变化 |
| | | */ |
| | | private void networkMonitoring() { |
| | | IntentFilter intentFilter = new IntentFilter(); |
| | | intentFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE"); |
| | | networkChangeReceiver = new NetworkChangeReceiver(); |
| | | registerReceiver(networkChangeReceiver, intentFilter); |
| | | } |
| | | |
| | | private void initEvent() { |
| | | viewBinding.myPowerStationBottomIl1.clickTv.setOnClickListener(new View.OnClickListener() { |
| | |
| | | HdlUniLogic.getInstance().checkRemoveOtherUniMPEventCallBack(); |
| | | //移除监听 |
| | | HDLLinkLocalSdk.getInstance().removeAllTopicsListener(allTopicsListener); |
| | | //移除监听网络状态变化 |
| | | unregisterReceiver(networkChangeReceiver); |
| | | |
| | | } |
| | | |
| | | private void initView() { |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | ; |
| | | HDLLinkLocalSdk.getInstance(). |
| | | |
| | | registerAllTopicsListener(allTopicsListener); |
| | | }; |
| | | HDLLinkLocalSdk.getInstance().registerAllTopicsListener(allTopicsListener); |
| | | } |
| | | |
| | | /** |