| | |
| | | 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 |
| | |
| | | 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); |
| | |
| | | initAll(); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 所有初始化全部在这个方法实现 |
| | | /// </summary> |
| | |
| | | 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(); |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Console.WriteLine(ex.Message); |
| | | MainPage.Log(ex.Message); |
| | | BaseActivity.VerifyDateTime = DateTime.MaxValue; |
| | | } |
| | | }; |
| | | |
| | |
| | | { |
| | | Language.CurrentLanguage = "English"; |
| | | } |
| | | |
| | | //获取极光推送ID |
| | | GetJPushRegistrationID(activity); |
| | | |
| | |
| | | BaseActivity.OnResumeAction += (activity) => |
| | | { |
| | | checkSomeInfo(); |
| | | |
| | | |
| | | |
| | | }; |
| | | BaseActivity.OnDestroyAction += (activity) => |
| | | { |
| | |
| | | //UserInfo.Current.unlockTime = DateTime.Now; |
| | | }; |
| | | |
| | | |
| | | |
| | | |
| | | HDLUtils.SetAuthoritiesName("com.hdl.onpro.fileProvider"); |
| | | |
| | |
| | | //关闭定位服务 |
| | | 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> |
| | |
| | | /// <param name="activity"></param> |
| | | void GetJPushRegistrationID(BaseActivity activity) |
| | | { |
| | | |
| | | try |
| | | { |
| | | |
| | | //保存获取的极光服务器上的注册ID到本地文件 |
| | | var tokenID = JPushInterface.GetRegistrationID(activity); |
| | | Console.WriteLine("RegistrationID: " + tokenID); |
| | |
| | | { |
| | | //手机名称 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); |
| | | |
| | | } |
| | |
| | | //进入后台mqtt正在连接重置状态 |
| | | HDL_ON.DAL.Mqtt.MqttClient.RemoteMqttIsConnecting = false; |
| | | HDL_ON.DriverLayer.UdpSocket._BusSocket.Stop(); |
| | | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | 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); |
| | | } |