From 792ca2a402feb952ef890d653f2e049c1230baf1 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期六, 19 十二月 2020 18:48:33 +0800
Subject: [PATCH] 1111
---
HDL-ON_Android/Application.cs | 74 +++++++++++++++++++++---------------
1 files changed, 43 insertions(+), 31 deletions(-)
diff --git a/HDL-ON_Android/Application.cs b/HDL-ON_Android/Application.cs
index 7317bbb..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) =>
@@ -65,24 +67,29 @@
//鑾峰彇鏋佸厜鎺ㄩ�両D
GetJPushRegistrationID(activity);
- 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) =>
{
@@ -92,32 +99,33 @@
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 = (lon, lat) =>
{
try
{
Shared.Application.LocationAction = null;
- Shared.Application.StopGPSLocationService();
new HDL_ON.DAL.Server.HttpServerRequest().GetCityInfo(lon.ToString(), lat.ToString());
+ //鍏抽棴瀹氫綅鏈嶅姟
+ Shared.Application.StopGPSLocationService();
}
- catch
+ catch(Exception ex)
{
-
+ Utlis.WriteLine("GetCityInfo catch"+ ex.Message);
}
MainPage.Log($"缁忕含搴�:::{lon}:{lat}");
};
@@ -136,11 +144,11 @@
//淇濆瓨鑾峰彇鐨勬瀬鍏夋湇鍔″櫒涓婄殑娉ㄥ唽ID鍒版湰鍦版枃浠�
var tokenID = JPushInterface.GetRegistrationID(activity);
Console.WriteLine("RegistrationID: " + tokenID);
- if (!string.IsNullOrEmpty(tokenID) && UserInfo.Current.PushDeviceToken != tokenID)
+ if (!string.IsNullOrEmpty(tokenID) && OnAppConfig.Instance.PushDeviceToken != tokenID)
{
- UserInfo.Current.PushDeviceToken = tokenID;
- UserInfo.Current.PhoneName = Android.OS.Build.Manufacturer;
- UserInfo.Current.SaveUserInfo();
+ OnAppConfig.Instance.PushDeviceToken = tokenID;
+ OnAppConfig.Instance.PhoneName = Android.OS.Build.Manufacturer;
+ OnAppConfig.Instance.SaveConfig();
}
int loadTokenCount = 0;
System.Threading.Tasks.Task.Run(() =>
@@ -157,11 +165,11 @@
}
}
Console.WriteLine("RegistrationID: " + tokenID);
- if (!string.IsNullOrEmpty(tokenID) && UserInfo.Current.PushDeviceToken != tokenID)
+ if (!string.IsNullOrEmpty(tokenID) && OnAppConfig.Instance.PushDeviceToken != tokenID)
{
- UserInfo.Current.PushDeviceToken = tokenID;
- UserInfo.Current.PhoneName = Android.OS.Build.Manufacturer;
- UserInfo.Current.SaveUserInfo();
+ OnAppConfig.Instance.PushDeviceToken = tokenID;
+ OnAppConfig.Instance.PhoneName = Android.OS.Build.Manufacturer;
+ OnAppConfig.Instance.SaveConfig();
}
});
@@ -273,6 +281,8 @@
{
Console.WriteLine("HHH OnActivityStarted锛歠oreground");
BusSocketStart();
+ //鍚庡彴鍥炲埌鍓嶅彴
+ new HDL_ON.UI.AppUnlockPage().LoadPage();
}
}
@@ -284,6 +294,9 @@
{
Console.WriteLine("HHH OnActivityStopped锛� background");
BusSocketStop();
+ //杩涘叆鍚庡彴
+ UserInfo.Current.unlockTime = DateTime.Now;
+
}
}
@@ -308,7 +321,6 @@
{
IsEnterBackground = true;
//BusSocket.Stop();
- OnAppConfig.Instance.unlockTime = DateTime.Now;
}
--
Gitblit v1.8.0