From 1a4b95a7ebef71838bd3eda2c22056bbf0db65ec Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期五, 10 一月 2020 16:39:54 +0800 Subject: [PATCH] 2019阶段备份 --- Shared.IOS/BaseApplicationDelegate.cs | 50 +++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 39 insertions(+), 11 deletions(-) diff --git a/Shared.IOS/BaseApplicationDelegate.cs b/Shared.IOS/BaseApplicationDelegate.cs index 077856f..387c0cb 100644 --- a/Shared.IOS/BaseApplicationDelegate.cs +++ b/Shared.IOS/BaseApplicationDelegate.cs @@ -25,7 +25,35 @@ Volume.Init(); FinishedLaunchingAction?.Invoke(application, launchOptions); - + /* + //GPS + if (Shared.Application.IsGpsEnable) + { + if (MyCLLocationManager.Instance.IsLocationServicesEnabled) + { + switch (Shared.Application.CurrentGpsUseMode) + { + case Application.GpsUseMode.Always: + MyCLLocationManager.Instance.RequestAlwaysAuthorization(); + break; + case Application.GpsUseMode.WhenInUse: + MyCLLocationManager.Instance.RequestWhenInUseAuthorization(); + break; + } + if (launchOptions != null && launchOptions.ObjectForKey(UIApplication.LaunchOptionsLocationKey) != null) + { + MyCLLocationManager.Instance.StartMonitoringSignificantLocationChanges(); + } + else + { + MyCLLocationManager.Instance.StartUpdatingLocation(); + } + } + else { + ///TODO 鍙互鎻愮ず鐢ㄦ埛鎵撳紑瀹氫綅鏉冮檺 + } + } + */ return true; } @@ -49,7 +77,7 @@ application.RegisterForRemoteNotificationTypes(UIRemoteNotificationType.NewsstandContentAvailability | UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound); } } - + /* class MyCLLocationManager : CLLocationManager { public static MyCLLocationManager Instance @@ -61,7 +89,7 @@ locationManager = new MyCLLocationManager(); //璁剧疆鏄惁鍏佽绯荤粺鑷姩鏆傚仠瀹氫綅 locationManager.PausesLocationUpdatesAutomatically = false; - //locationManager.AllowsBackgroundLocationUpdates = true; + locationManager.AllowsBackgroundLocationUpdates = true; //璁剧疆瀹氫綅绮惧害 locationManager.DesiredAccuracy = CLLocation.AccuracyKilometer; locationManager.init(); @@ -93,18 +121,18 @@ { var location = e.Locations[e.Locations.Length - 1]; //adjustDistanceFilter(location); - System.Console.WriteLine($"浣嶇疆淇℃伅鍙樺寲 缁忓害{location.Coordinate.Longitude} 绾害{location.Coordinate.Latitude}"); + //System.Console.WriteLine($"浣嶇疆淇℃伅鍙樺寲 缁忓害{location.Coordinate.Longitude} 绾害{location.Coordinate.Latitude}"); uploadToServer(location); }; } } - /** - * 瑙勫垯: 濡傛灉閫熷害灏忎簬minSpeed m/s 鍒欐妸瑙﹀彂鑼冨洿璁惧畾涓�100m - * 鍚﹀垯灏嗚Е鍙戣寖鍥磋瀹氫负minSpeed*minInteval - * 姝ゆ椂鑻ラ�熷害鍙樺寲瓒呰繃10% 鍒欐洿鏂板綋鍓嶇殑瑙﹀彂鑼冨洿(杩欓噷闄愬埗鏄洜涓轰笉鑳戒笉鍋滅殑璁剧疆distanceFilter, - * 鍚﹀垯uploadLocation浼氫笉鍋滆瑙﹀彂) -*/ + + //* 瑙勫垯: 濡傛灉閫熷害灏忎簬minSpeed m/s 鍒欐妸瑙﹀彂鑼冨洿璁惧畾涓�100m + //* 鍚﹀垯灏嗚Е鍙戣寖鍥磋瀹氫负minSpeed*minInteval + //* 姝ゆ椂鑻ラ�熷害鍙樺寲瓒呰繃10% 鍒欐洿鏂板綋鍓嶇殑瑙﹀彂鑼冨洿(杩欓噷闄愬埗鏄洜涓轰笉鑳戒笉鍋滅殑璁剧疆distanceFilter, + //* 鍚﹀垯uploadLocation浼氫笉鍋滆瑙﹀彂) + void adjustDistanceFilter(CLLocation location) { // NSLog(@"adjust:%f",location.speed); @@ -172,7 +200,7 @@ } } } - + */ public override void OnResignActivation(UIApplication application) => OnResignActivationAction?.Invoke(application);// Invoked when the application is about to move from active to inactive state.// This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) // or when the user quits the application and it begins the transition to the background state.// Games should use this method to pause the game. public override void DidEnterBackground(UIApplication application) => DidEnterBackgroundAction?.Invoke(application);// Use this method to release shared resources, save user data, invalidate timers and store the application state.// If your application supports background exection this method is called instead of WillTerminate when the user quits. -- Gitblit v1.8.0