From 9f326f4000847e6167d8166fa2f6a66f53cb3734 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期四, 17 十二月 2020 09:07:13 +0800 Subject: [PATCH] 新云端Ver1.3 --- ZigbeeApp/GateWay.Droid/Application.cs | 55 ++++++++++++++++++++++++++++++++++++------------------- 1 files changed, 36 insertions(+), 19 deletions(-) diff --git a/ZigbeeApp/GateWay.Droid/Application.cs b/ZigbeeApp/GateWay.Droid/Application.cs index 7858c42..71da5ff 100755 --- a/ZigbeeApp/GateWay.Droid/Application.cs +++ b/ZigbeeApp/GateWay.Droid/Application.cs @@ -20,7 +20,6 @@ namespace com.hdl.home { - [Activity(Name = "com.hdl.home.wxapi.WXEntryActivity", Exported = true, Theme = "@android:style/Theme.Translucent", LaunchMode = Android.Content.PM.LaunchMode.SingleTask)] class WXEntryActivity : Android.App.Activity, IWXAPIEventHandler { @@ -83,6 +82,12 @@ public class Application : Android.App.Application { public Application(IntPtr handle, Android.Runtime.JniHandleOwnership ownerShip) : base(handle, ownerShip) { } + + /// <summary> + /// 妫�娴嬪唴瀛樻硠闇茬殑涓滆タ + /// </summary> + ///private Square.LeakCanary.RefWatcher _refWatcher; + public override void OnCreate() { //濡傛灉涓嶆槸App鐨勪富杩涚▼,鍒欎笉闇�瑕佸鐞� @@ -99,11 +104,18 @@ catch (Exception ex) { //璋冭瘯:璁板綍绯荤粺寮傚父 - Shared.Phone.UserCenter.HdlLogLogic.Current.WriteOtherText(Shared.Phone.UserCenter.DirNameResourse.SystemLogFile, ex.Message + "\r\n" + ex.StackTrace, true, false); + Shared.Phone.HdlLogLogic.Current.WriteOtherText(Shared.Phone.HdlFileNameResourse.LogDirectory, ex.Message + "\r\n" + ex.StackTrace, true, false); } - base.OnCreate(); - // 閫氳繃WXAPIFactory宸ュ巶锛岃幏鍙朓WXAPI鐨勫疄渚� - //api = WXAPIFactory.CreateWXAPI(this, "wx2ec8f53f6fa36e82", true); + base.OnCreate(); + // 閫氳繃WXAPIFactory宸ュ巶锛岃幏鍙朓WXAPI鐨勫疄渚� + //api = WXAPIFactory.CreateWXAPI(this, "wx2ec8f53f6fa36e82", true); + + //妫�娴嬪唴瀛樻硠闇茬殑涓滆タ + //if (Square.LeakCanary.LeakCanaryXamarin.IsInAnalyzerProcess(this) == false) + //{ + // _refWatcher = Square.LeakCanary.LeakCanaryXamarin.Install(this); + // _refWatcher.Watch(this); + //} // 灏嗗簲鐢ㄧ殑appId娉ㄥ唽鍒板井淇� api?.RegisterApp("wx2ec8f53f6fa36e82"); @@ -136,12 +148,14 @@ var req = new SendAuth.Req { Scope = "snsapi_userinfo", State = "ZigbeeApp" }; api?.SendReq(req); } + /// <summary> /// 鎵�鏈夊垵濮嬪寲鍏ㄩ儴鍦ㄨ繖涓柟娉曞疄鐜� /// </summary> void initAll() { - Shared.Application.IsGpsEnable = System.IO.File.Exists(Shared.Phone.UserCenter.DirNameResourse.OpenGbsFile); + //鍙栨秷灞忓箷甯镐寒 + BaseActivity.KeepScreenON = false; //闅愯棌搴曢儴杞寜閿� BaseActivity.IsHideVirualButtons = true; @@ -161,7 +175,7 @@ { try { - if (Shared.Common.CommonPage.BackKeyCanClick == false) + if (Shared.Common.Config.Instance.BackKeyCanClick == false) { //涓嶅厑璁告寜杩斿洖閿� return; @@ -211,17 +225,21 @@ { Shared.Application.FontSize = 12; AppCenter.Start("4802834a-e7e9-4dd8-93f1-c2f88f0bd464", typeof(Analytics), typeof(Crashes)); -#if Release - //淇濆瓨鑾峰彇鐨勬瀬鍏夋湇鍔″櫒涓婄殑娉ㄥ唽ID鍒版湰鍦版枃浠� - var registrationId = JPushInterface.GetRegistrationID(activity); +#if DEBUG + //娴嬭瘯ID,鐬庡啓鐨� + Shared.Common.Config.Instance.RegistrationID = "93f1c2f88f0bd464"; +#endif +#if Release + //淇濆瓨鑾峰彇鐨勬瀬鍏夋湇鍔″櫒涓婄殑娉ㄥ唽ID鍒版湰鍦版枃浠� + var registrationId = JPushInterface.GetRegistrationID(activity); System.Console.WriteLine("registrationId-鏋佸厜id=" + registrationId); - if (!string.IsNullOrEmpty(registrationId)) - { - Shared.Common.Config.Instance.RegistrationID = registrationId; - Shared.Common.Config.Instance.Save(); - } - //璋冭瘯:璁板綍鏋佸厜ID - Shared.Phone.UserCenter.HdlLogLogic.Current.WriteOtherText(Shared.Phone.UserCenter.DirNameResourse.JiguangFile, "receive1:" + registrationId, true, true); + if (!string.IsNullOrEmpty(registrationId)) + { + Shared.Common.Config.Instance.RegistrationID = registrationId; + Shared.Common.Config.Instance.Save(); + } + //璋冭瘯:璁板綍鏋佸厜ID + Shared.Phone.UserCenter.HdlLogLogic.Current.WriteOtherText(Shared.Phone.UserCenter.DirNameResourse.JiguangFile, "receive1:" + registrationId, true, true); #endif }; BaseActivity.RefreshUIAction += (activity) => @@ -361,7 +379,6 @@ if (!string.IsNullOrEmpty(regId)) { Shared.Common.Config.Instance.RegistrationID = regId; - Shared.Common.Config.Instance.Save(); } #if Release //璋冭瘯:璁板綍鏋佸厜ID @@ -410,7 +427,7 @@ System.Console.WriteLine(TAG, "extras : " + extras); //澶勭悊鏋佸厜娑堟伅鎺ㄩ�佺殑閫昏緫鍑芥暟 - Shared.Phone.UserCenter.HdlJiguangMsgPushLogic.Current.AdjustJiguangMsgPush(title, message, extras); + Shared.Phone.HdlJiguangMsgPushLogic.Current.AdjustJiguangMsgPush(title, message, extras); } /// <summary> /// 鎵撳紑娑堟伅鏄剧ず鐣岄潰 -- Gitblit v1.8.0