From c1cb2d8c6034a2ee7aa8a5710bba15b14f76cebc Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期五, 18 八月 2023 18:54:31 +0800
Subject: [PATCH] 2023年08月18日18:54:22

---
 HDL-ON_Android/SplashActivity.cs |   68 ++++++++++++++++++++++++++-------
 1 files changed, 53 insertions(+), 15 deletions(-)

diff --git a/HDL-ON_Android/SplashActivity.cs b/HDL-ON_Android/SplashActivity.cs
index c9f122a..4fccb42 100644
--- a/HDL-ON_Android/SplashActivity.cs
+++ b/HDL-ON_Android/SplashActivity.cs
@@ -3,6 +3,7 @@
 using Android.App;
 using Android.Content;
 using Android.Content.PM;
+using Android.Locations;
 using Android.Net;
 using Android.OS;
 using Android.Support.V4.App;
@@ -49,12 +50,20 @@
         {
             base.OnCreate(savedInstanceState);
 
+            if(Shared.Application.Activity != null && Shared.Application.Activity.GetType() == typeof(BaseActivity))
+            {
+                Finish();
+                return;
+            }
+
             //Intent i = new Intent(this, typeof(BaseActivity));//Intent intent=new Intent( 璧峰缁勪欢瀵硅薄 , 鐩爣 Service.class);
             //StartActivityForResult(i, 1);
             //OverridePendingTransition(0, 0);
             //initAll();
             if (HDL_ON.OnAppConfig.Instance.FirstRunApp || !HDL_ON.OnAppConfig.Instance.isAgreePrivacyPolicy)
             {
+                //OnAppConfig.Instance.FirstRunApp = false;
+                //OnAppConfig.Instance.SaveConfig();
                 Language.CurrentLanguage = "Chinese";
                 Locale locale1 = Locale.Default;
                 var localeList = Resources.Configuration.Locale;
@@ -126,7 +135,7 @@
             JPushInterface.Init(this);
 
             Com.Chteam.Agent.BuglyAgentHelper.Init(this.ApplicationContext, "316a8f5d83");
-
+            
 
             BaseActivity.OnCreateActoin += (activity, application) =>
             {
@@ -180,7 +189,7 @@
                 }
             };
 
-            BaseActivity.OnCreateActoin += (activity, application) =>
+            BaseActivity.OnCreateActoin = (activity, application) =>
             {
                 Language.CurrentLanguage = "Chinese";
                 Locale locale1 = Locale.Default;
@@ -229,7 +238,7 @@
                     HDLCommon.Current.UpdateInternetStatus((int)internetStatus, MainPage.IsEnterBackground);
                 };
             };
-            BaseActivity.RefreshUIAction += (activity) =>
+            BaseActivity.RefreshUIAction = (activity) =>
             {
                 Language.CurrentLanguage = "Chinese";
                 Locale locale1 = Locale.Default;
@@ -258,11 +267,11 @@
                 MainPage.Show();
                 checkSomeInfo();
             };
-            BaseActivity.OnResumeAction += (activity) =>
+            BaseActivity.OnResumeAction = (activity) =>
             {
                 checkSomeInfo();
             };
-            BaseActivity.OnDestroyAction += (activity) =>
+            BaseActivity.OnDestroyAction = (activity) =>
             {
                 Console.WriteLine("OnDestroyAction");
                 //BusSocket.Stop();
@@ -275,20 +284,20 @@
             //Shared.Application.IsGpsEnable = true;
             //bool isfirst = true;
 
-            
 
+
+            var isfirst = true;
             //鑾峰彇缁忕含搴� 
             Shared.Application.LocationAction = (lon, lat) =>
             {
                 try
                 {
-                    //if (isfirst)
-                    //{
-                    //    //鍙Е鍙戜竴娆�
-                    //    //Shared.Application.LocationAction = null;
-                    //    new HDL_ON.DAL.Server.HttpServerRequest().GetCityWeatherInfo(lon.ToString().Replace(",", "."), lat.ToString().Replace(",", "."));
-                    //}
-                    //isfirst = false;
+                    if (isfirst)
+                    {
+                        //鍙Е鍙戜竴娆�
+                        new HDL_ON.DAL.Server.HttpServerRequest().GetCityWeatherInfo(lon.ToString().Replace(",", "."), lat.ToString().Replace(",", "."));
+                    }
+                    isfirst = false;
                     ///鐩戝惉缁忕含搴�
                     HDL_ON.UI.UI2.Intelligence.Automation.LogicMethod.Current.AppLatAndLonEvent(lon, lat);
                     //鍏抽棴瀹氫綅鏈嶅姟
@@ -410,7 +419,36 @@
         }
 
 
+
+
+
+        // 鍦ㄤ綘鐨勬椿鍔紙Activity锛夋垨鐗囨锛團ragment锛変腑鐨勬煇涓柟娉曚腑锛屽紑濮嬬洃鍚綅缃彉鍖�
+        void StartLocationUpdates()
+        {
+            // 鍒涘缓浣嶇疆绠$悊鍣�
+            var locationManager = (LocationManager)GetSystemService(Context.LocationService);
+
+            // 璁剧疆浣嶇疆鐩戝惉鍣�
+            var locationListener = new MyLocationListener_V2();
+
+            // 璇锋眰浣嶇疆鏇存柊
+            locationManager.RequestLocationUpdates(LocationManager.GpsProvider, 0, 0, locationListener);
+        }
+
+        // 鍦ㄤ綘鐨勬椿鍔紙Activity锛夋垨鐗囨锛團ragment锛変腑鐨勬煇涓柟娉曚腑锛屽仠姝㈢洃鍚綅缃彉鍖�
+        void StopLocationUpdates()
+        {
+            // 鍒涘缓浣嶇疆绠$悊鍣�
+            var locationManager = (LocationManager)GetSystemService(Context.LocationService);
+
+            // 璁剧疆浣嶇疆鐩戝惉鍣�
+            var locationListener = new MyLocationListener_V2();
+
+            // 鍋滄浣嶇疆鏇存柊
+            locationManager.RemoveUpdates(locationListener);
+        }
+
+
+
     }
-
-
 }
\ No newline at end of file

--
Gitblit v1.8.0