| | |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.appcompat.content.res.AppCompatResources; |
| | | import androidx.core.app.ActivityCompat; |
| | | |
| | | import android.Manifest; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.content.pm.PackageManager; |
| | | import android.location.Location; |
| | | import android.location.LocationListener; |
| | | import android.location.LocationManager; |
| | | import android.os.Bundle; |
| | | import android.os.Process; |
| | |
| | | import android.text.TextUtils; |
| | | import android.view.View; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hdl.linkpm.sdk.core.exception.HDLException; |
| | |
| | | |
| | | |
| | | /** |
| | | * 我的电站界面 |
| | | * B端-电站界面 |
| | | */ |
| | | public class MyPowerStationActivity extends CustomBaseActivity { |
| | | |
| | |
| | | UserConfigManage.getInstance().Save(); |
| | | } |
| | | HDLApp.getInstance().setInfoMap(registrationId_tag, "true");//记录一下状态,后台杀死app会清空; |
| | | HdlLogLogic.print("添加极光ID到云端--->registrationID:" + finalRegistrationID, true); |
| | | HdlLogLogic.print("添加极光ID到云端--->registrationID:" + UserConfigManage.getInstance().getUserName() + "--->" + finalRegistrationID, true); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | HDLApp.getInstance().setInfoMap(registrationId_tag, "false");//记录一下状态,后台杀死app会清空; |
| | | HdlLogLogic.print("添加极光ID到云端失败--->registrationID:" + finalRegistrationID, true); |
| | | HdlLogLogic.print("添加极光ID到云端失败--->registrationID:" + UserConfigManage.getInstance().getUserName() + "--->" + finalRegistrationID, true); |
| | | } |
| | | }); |
| | | |
| | |
| | | HdlUniLogic.getInstance().checkRemoveOtherUniMPEventCallBack(); |
| | | //移除监听 |
| | | HDLLinkLocalSdk.getInstance().removeAllTopicsListener(allTopicsListener); |
| | | //断开mqtt连接 |
| | | if (MqttRecvClient.getInstance() != null) { |
| | | MqttRecvClient.getInstance().stop(); |
| | | } |
| | | |
| | | } |
| | | |
| | | private void initView() { |
| | |
| | | viewBinding.myMessageBottomIl2.titleTv.setText(R.string.message); |
| | | viewBinding.myMeBottomIl3.titleTv.setText(R.string.power_station_me); |
| | | this.bottomViewChangeOfStyle(); |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | public void requestPermissions() { |
| | | //消息通知限权 |
| | | this.notificationSet(); |
| | | //Manifest.permission.ACCESS_COARSE_LOCATION |
| | | //ACCESS_FINE_LOCATION 允许使用GPS定位 |
| | | //ACCESS_COARSE_LOCATION 允许使用WIFI热点或基站来获取粗略的定位 |
| | | String[] ary = PermissionUtils.checkPermission(_mActivity, new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}); |
| | |
| | | * 初始化mqtt客户端 |
| | | */ |
| | | public void initMqttClient() { |
| | | |
| | | HdlMqttLogic.getInstance().getMqttRemoteInfo(HomeType.A, new CloudCallBeak<MqttInfo>() { |
| | | @Override |
| | | public void onSuccess(MqttInfo info) { |
| | |
| | | |
| | | |
| | | /** |
| | | * 物理按键返回事件 |
| | | * 物理按键返回事件(包括左滑移除事件) |
| | | */ |
| | | @Override |
| | | public void onBackPressed() { |