From 925e55bc815de89575ec53880d3e059596fda6e6 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期六, 19 十二月 2020 13:23:46 +0800 Subject: [PATCH] Merge branch 'CJL' into NewFilePath --- HDL-ON_Android/Application.cs | 98 ++++++++++++++++++++++++++++--------------------- 1 files changed, 56 insertions(+), 42 deletions(-) diff --git a/HDL-ON_Android/Application.cs b/HDL-ON_Android/Application.cs index 8b47174..3d80e26 100644 --- a/HDL-ON_Android/Application.cs +++ b/HDL-ON_Android/Application.cs @@ -49,7 +49,9 @@ string[] permissions = new string[] { Manifest.Permission.WriteExternalStorage, Manifest.Permission.RecordAudio, Manifest.Permission.Camera, Manifest.Permission.ProcessOutgoingCalls, Manifest.Permission.GetAccounts}; - + //绂佹灞忓箷闀夸寒 + BaseActivity.KeepScreenON = false; + //闅愯棌杩嫓铏氭嫙鎸夐敭 BaseActivity.IsHideVirualButtons = true; init(); BaseActivity.OnCreateActoin += (activity, application) => @@ -61,31 +63,33 @@ { Language.CurrentLanguage = "Chinese"; } -#if DEBUG + + //鑾峰彇鏋佸厜鎺ㄩ�両D + GetJPushRegistrationID(activity); -#else - //娉ㄥ唽鏋佸厜鎺ㄩ�� - InitJPush(activity); -#endif - - BaseActivity.NetworkStateChanged += (int obj) => + BaseActivity.NetworkStateChanged += (int internetStatus) => { - if (!IsEnterBackground) - { - //BusSocket.Stop(); - new System.Threading.Thread(() => - { - System.Threading.Thread.Sleep(1000); - //BusSocket.Start(); - }) - { IsBackground = true }.Start(); - } - else - { - Console.WriteLine("HHH 缃戠粶鍙樺寲浣嗗浜庡悗鍙�"); - } + //if (!IsEnterBackground) + //{ + // ////BusSocket.Stop(); + // //new System.Threading.Thread(() => + // //{ + // // System.Threading.Thread.Sleep(1000); + // // //BusSocket.Start(); + // //}) + // //{ IsBackground = true }.Start(); + //} + //else + //{ + // Console.WriteLine("HHH 缃戠粶鍙樺寲浣嗗浜庡悗鍙�"); + //} + + //缃戠粶鍙樺寲澶勭悊 + HDLCommon.Current.UpdateInternetStatus((int)internetStatus, IsEnterBackground); }; + //寮�鍚畾浣嶆湇鍔� + Shared.Application.StartGPSLocationService(); }; BaseActivity.RefreshUIAction += (activity) => { @@ -95,39 +99,48 @@ BaseActivity.OnResumeAction += (activity) => { checkSomeInfo(); - new HDL_ON.UI.AppUnlockPage().LoadPage(); + }; BaseActivity.OnDestroyAction += (activity) => { Console.WriteLine("OnDestroyAction"); //BusSocket.Stop(); - OnAppConfig.Instance.unlockTime = DateTime.Now; + //UserInfo.Current.unlockTime = DateTime.Now; }; + HDLUtils.SetAuthoritiesName("com.hdl.onpro.fileProvider"); //Shared.Application.IsGpsEnable = true; - - Shared.Application.LocationAction = (arg1, arg2) => + //鑾峰彇缁忕含搴� + Shared.Application.LocationAction = (lon, lat) => { - Shared.Application.LocationAction = null; - - new HDL_ON.DAL.Server.HttpServerRequest().GetCityInfo(arg1.ToString(), arg2.ToString()); - - MainPage.Log($"缁忕含搴�:::{arg1}:{arg2}"); + try + { + Shared.Application.LocationAction = null; + new HDL_ON.DAL.Server.HttpServerRequest().GetCityInfo(lon.ToString(), lat.ToString()); + //鍏抽棴瀹氫綅鏈嶅姟 + Shared.Application.StopGPSLocationService(); + } + catch(Exception ex) + { + Utlis.WriteLine("GetCityInfo catch"+ ex.Message); + } + MainPage.Log($"缁忕含搴�:::{lon}:{lat}"); }; + + } /// <summary> /// /// </summary> /// <param name="activity"></param> - void InitJPush(BaseActivity activity) + void GetJPushRegistrationID(BaseActivity activity) { try { - //#if Release //淇濆瓨鑾峰彇鐨勬瀬鍏夋湇鍔″櫒涓婄殑娉ㄥ唽ID鍒版湰鍦版枃浠� var tokenID = JPushInterface.GetRegistrationID(activity); Console.WriteLine("RegistrationID: " + tokenID); @@ -135,7 +148,7 @@ { OnAppConfig.Instance.PushDeviceToken = tokenID; OnAppConfig.Instance.PhoneName = Android.OS.Build.Manufacturer; - OnAppConfig.Instance.SaveUserConfig(); + OnAppConfig.Instance.SaveConfig(); } int loadTokenCount = 0; System.Threading.Tasks.Task.Run(() => @@ -156,11 +169,10 @@ { OnAppConfig.Instance.PushDeviceToken = tokenID; OnAppConfig.Instance.PhoneName = Android.OS.Build.Manufacturer; - OnAppConfig.Instance.SaveUserConfig(); + OnAppConfig.Instance.SaveConfig(); } }); - //#endif } catch { @@ -174,12 +186,10 @@ //鎵嬫満鍚嶇О Android.OS.Build.Manufacturer; //OnAppConfig.Instance.PhoneName = Android.OS.Build.Manufacturer; #if DEBUG - -#else - //璁剧疆鏋佸厜璋冭瘯妯″紡锛屼负false鏃跺彧鎵撳嵃璀﹀憡淇℃伅 - JPushInterface.SetDebugMode(false); - JPushInterface.Init(this);//淇濆瓨鎵嬫満鍚嶇О鍒版湰鍦版枃浠� + CN.Jpush.Android.Api.JPushInterface.SetDebugMode(true); #endif + CN.Jpush.Android.Api.JPushInterface.Init(this); + } void checkSomeInfo() { @@ -271,6 +281,8 @@ { Console.WriteLine("HHH OnActivityStarted锛歠oreground"); BusSocketStart(); + //鍚庡彴鍥炲埌鍓嶅彴 + new HDL_ON.UI.AppUnlockPage().LoadPage(); } } @@ -282,6 +294,9 @@ { Console.WriteLine("HHH OnActivityStopped锛� background"); BusSocketStop(); + //杩涘叆鍚庡彴 + UserInfo.Current.unlockTime = DateTime.Now; + } } @@ -306,7 +321,6 @@ { IsEnterBackground = true; //BusSocket.Stop(); - OnAppConfig.Instance.unlockTime = DateTime.Now; } -- Gitblit v1.8.0