wxr
2021-07-01 43b0d5870d528f23ecd6aeceb6cfd4325188b46f
HDL-ON_Android/Application.cs
@@ -11,6 +11,9 @@
using CN.Jpush.Android.Api;
using HDL_ON;
using Java.Util;
using Microsoft.AppCenter;
using Microsoft.AppCenter.Analytics;
using Microsoft.AppCenter.Crashes;
using Shared;
namespace HDL_ON_Android
@@ -33,8 +36,7 @@
        public override void OnCreate()
        {
            //注册未处理异常事件
            Com.Chteam.Agent.BuglyAgentHelper.Init(this.ApplicationContext, "cb89f20750");
            AppCenter.Start("64ac5859-2cd7-4ef8-a5da-5455e29679ec", typeof(Analytics), typeof(Crashes));
            if (Shared.Application.Activity != null)
            {
                reStartApp(this);
@@ -47,6 +49,9 @@
            initAll();
        }
        /// <summary>
        /// 所有初始化全部在这个方法实现
        /// </summary>
@@ -57,10 +62,11 @@
            Manifest.Permission.Camera, Manifest.Permission.ProcessOutgoingCalls, Manifest.Permission.GetAccounts};
            //禁止屏幕长亮
            BaseActivity.KeepScreenON = false;
            //隐藏迪拜虚拟按键
            //隐藏虚拟按键
            BaseActivity.IsHideVirualButtons = true;
            //实现安卓返回按键
            BaseActivity.BackKeyAction = () => {
            BaseActivity.BackKeyAction = () =>
            {
                try
                {
                    var result = MainPage.LoadEvent_BackAction();
@@ -79,7 +85,8 @@
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    MainPage.Log(ex.Message);
                    BaseActivity.VerifyDateTime = DateTime.MaxValue;
                }
            };
@@ -93,7 +100,10 @@
                {
                    Language.CurrentLanguage = "Chinese";
                }
                else
                {
                    Language.CurrentLanguage = "English";
                }
                //获取极光推送ID
                GetJPushRegistrationID(activity);
@@ -129,7 +139,8 @@
            BaseActivity.OnResumeAction += (activity) =>
            {
                checkSomeInfo();
            };
            BaseActivity.OnDestroyAction += (activity) =>
            {
@@ -138,7 +149,7 @@
                //UserInfo.Current.unlockTime = DateTime.Now;
            };
            HDLUtils.SetAuthoritiesName("com.hdl.onpro.fileProvider");
@@ -153,14 +164,14 @@
                    //关闭定位服务
                    Shared.Application.StopGPSLocationService();
                }
                  catch(Exception ex)
                catch (Exception ex)
                {
                    Utlis.WriteLine("GetCityInfo catch"+ ex.Message);
                    Utlis.WriteLine("GetCityInfo catch" + ex.Message);
                }
                MainPage.Log($"经纬度:::{lon}:{lat}");
            };
        }
        /// <summary>
@@ -169,8 +180,10 @@
        /// <param name="activity"></param>
        void GetJPushRegistrationID(BaseActivity activity)
        {
            try
            {
                //保存获取的极光服务器上的注册ID到本地文件
                var tokenID = JPushInterface.GetRegistrationID(activity);
                Console.WriteLine("RegistrationID:  " + tokenID);
@@ -215,9 +228,9 @@
        {
            //手机名称 Android.OS.Build.Manufacturer;
            //OnAppConfig.Instance.PhoneName = Android.OS.Build.Manufacturer;
#if DEBUG
            CN.Jpush.Android.Api.JPushInterface.SetDebugMode(true);
#endif
//#if DEBUG
            //CN.Jpush.Android.Api.JPushInterface.SetDebugMode(true);
//#endif
            CN.Jpush.Android.Api.JPushInterface.Init(this);
        }
@@ -360,7 +373,7 @@
            //进入后台mqtt正在连接重置状态
            HDL_ON.DAL.Mqtt.MqttClient.RemoteMqttIsConnecting = false;
            HDL_ON.DriverLayer.UdpSocket._BusSocket.Stop();
        }
        /// <summary>
@@ -373,7 +386,7 @@
            if (CloseTime.AddSeconds(10) < DateTime.Now)
            {
                //后台超过10s就断开MQTT重连
                if (HDL_ON.DriverLayer.Control.Ins.IsRemote)
                //if (HDL_ON.DriverLayer.Control.Ins.IsRemote)
                {
                    HDL_ON.DAL.Mqtt.MqttClient.DisConnectRemote("closeTime", false);
                }