From 203c3a3ffde6259413d9743f6a723b95b1e7989c Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 06 七月 2023 22:43:05 +0800
Subject: [PATCH] 门锁功能

---
 HDL-ON_Android/SplashActivity.cs |   75 +++++++++++++++++++++++++++++++++----
 1 files changed, 67 insertions(+), 8 deletions(-)

diff --git a/HDL-ON_Android/SplashActivity.cs b/HDL-ON_Android/SplashActivity.cs
index 1fbe7c2..afcffdf 100644
--- a/HDL-ON_Android/SplashActivity.cs
+++ b/HDL-ON_Android/SplashActivity.cs
@@ -1,9 +1,13 @@
 锘縰sing System;
+using Android;
 using Android.App;
 using Android.Content;
 using Android.Content.PM;
+using Android.Locations;
 using Android.Net;
 using Android.OS;
+using Android.Support.V4.App;
+using Android.Support.V4.Content;
 using CN.Jpush.Android.Api;
 //using Android.Widget;
 using Com.Hdl.ON.Jpush.Androidjpush;
@@ -20,6 +24,10 @@
     [IntentFilter(new string[] { "com.hdl.onpro.SplashActivity", Intent.ActionView })]
     public class SplashActivity : Activity
     {
+
+
+
+
         protected override void OnActivityResult(int requestCode, Result resultVal, Intent data)
         {
             if (requestCode == 99)
@@ -92,6 +100,25 @@
             }
         }
 
+
+        public void Permissions()
+        {
+            string[] mPermissionList = new string[]
+            {
+                Manifest.Permission.ReadSms
+            };
+
+            foreach (string permissions in mPermissionList)
+            {
+                if (ContextCompat.CheckSelfPermission(this, permissions) != 0)
+                {
+                    ActivityCompat.RequestPermissions(this, new string[] { permissions }, 1);
+                }
+            }
+        }
+
+
+
         void initOhterSdk()
         {
             //娉ㄥ唽鏈鐞嗗紓甯镐簨浠�
@@ -103,9 +130,8 @@
             //#endif
             JPushInterface.Init(this);
 
-            //Com.Chteam.Agent.BuglyAgentHelper.Init(this.ApplicationContext, "316a8f5d83");
-
-
+            Com.Chteam.Agent.BuglyAgentHelper.Init(this.ApplicationContext, "316a8f5d83");
+            
 
             BaseActivity.OnCreateActoin += (activity, application) =>
             {
@@ -252,17 +278,19 @@
             HDLUtils.SetAuthoritiesName("com.hdl.onpro.fileProvider");
 
             //Shared.Application.IsGpsEnable = true;
-            bool isfirst = 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;
@@ -278,6 +306,8 @@
                 MainPage.Log($"缁忕含搴�:::{lon}:{lat}");
             };
         }
+
+        
 
         /// <summary>
         /// 
@@ -385,7 +415,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